Package org.apache.hadoop.hive.serde2.io

Examples of org.apache.hadoop.hive.serde2.io.TimestampWritable


  }

  public OrcLazyTimestamp(OrcLazyTimestamp copy) {
    super(copy);
    if (copy.previous != null) {
      previous = new TimestampWritable(((TimestampWritable)copy.previous));
    }
  }
View Full Code Here


    super(PrimitiveObjectInspectorUtils.timestampTypeEntry);
  }

  @Override
  public Timestamp getPrimitiveJavaObject(Object o) {
    TimestampWritable writable = getPrimitiveWritableObject(o);
    return writable == null ? null : writable.getTimestamp();
  }
View Full Code Here

      int nextCalls = 0;

      @Override
      public Object next(Object previous) throws IOException {
        if (nextCalls == 0) {
          return new TimestampWritable(new Timestamp(1));
        }

        throw new IOException("next should only be called once");
      }
View Full Code Here

    return nanos.loadIndeces(rowIndexEntries, updatedStartIndex);
  }

  @Override
  public Object next(Object previous) throws IOException {
    TimestampWritable result = null;
    if (valuePresent) {
      if (previous == null) {
        result = new TimestampWritable();
      } else {
        result = (TimestampWritable) previous;
      }
      long millis = (data.next() + WriterImpl.BASE_TIMESTAMP) *
          WriterImpl.MILLIS_PER_SECOND;
      int newNanos = parseNanos(nanos.next());
      // fix the rounding when we divided by 1000.
      if (millis >= 0) {
        millis += newNanos / 1000000;
      } else {
        millis -= newNanos / 1000000;
      }
      Timestamp timestamp = result.getTimestamp();
      timestamp.setTime(millis);
      timestamp.setNanos(newNanos);
      result.set(timestamp);
    }
    return result;
  }
View Full Code Here

        public TimestampWritable getPrimitiveWritableObject(Object o) {
            java.sql.Timestamp value = getPrimitiveJavaObject(o);
            if (value == null) {
                return null;
            }
            return new TimestampWritable(value);
        }
View Full Code Here

                target.setNull();
            } else if (primitive) {
                Timestamp entity = inspector.getPrimitiveJavaObject(value);
                set(target, entity);
            } else {
                TimestampWritable writable = inspector.getPrimitiveWritableObject(value);
                set(target, writable.getTimestamp());
            }
        }
View Full Code Here

        assertThat(inspector.copyObject(option), is((Object) option));
        assertThat(inspector.copyObject(option), is(not(sameInstance((Object) option))));
        assertThat(inspector.copyObject(null), is(nullValue()));
        assertThat(inspector.getPrimitiveJavaObject(option), is(value));
        assertThat(inspector.getPrimitiveJavaObject(null), is(nullValue()));
        assertThat(inspector.getPrimitiveWritableObject(option), is(new TimestampWritable(value)));
        assertThat(inspector.getPrimitiveWritableObject(null), is(nullValue()));

        ValueDriver driver = serde.getDriver(inspector);
        DateOption copy = new DateOption();
View Full Code Here

            target.setNull();
        } else if (primitive) {
            java.sql.Timestamp entity = inspector.getPrimitiveJavaObject(value);
            setDate(target, entity);
        } else {
            TimestampWritable writable = inspector.getPrimitiveWritableObject(value);
            setDate(target, writable.getTimestamp());
        }
    }
View Full Code Here

    public TimestampWritable getPrimitiveWritableObject(Object o) {
        java.sql.Timestamp value = getPrimitiveJavaObject(o);
        if (value == null) {
            return null;
        }
        return new TimestampWritable(value);
    }
View Full Code Here

        Arrays.asList(new Text("666-677-9999"))));
    map.put(new Text("Bob"), OrcUtils.createOrcStruct(Person.TYPE_INFO, new Text("Bob"), new IntWritable(26),
        Arrays.asList(new Text("999-888-1132"), new Text("000-222-9934"))));
    map.put(new Text("David"), null);
    OrcStruct s = OrcUtils.createOrcStruct(AddressBook.TYPE_INFO, new Text("John Smith"),
        Arrays.asList(new Text("919-333-4452"), new Text("650-777-4329")), map, new TimestampWritable(now),
        new BytesWritable(signature));
    OrcWritable w = new OrcWritable();
    w.set(s);
   
    testInputOutputFn(ptype, ab, w);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.serde2.io.TimestampWritable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.