use of org.apache.drill.exec.store.hive.writers.primitive.HiveTimestampWriter in project drill by apache.
the class TestTimeStampWriter method testTimestampWriter.
@Test
public void testTimestampWriter() {
TestTimeStampWriter testWriter = new TestTimeStampWriter();
HiveTimestampWriter writer = new HiveTimestampWriter(new WritableTimestampObjectInspector(), testWriter);
// parquet long logical-type TIMESTAMP_MICRO
long testLong = 1643341736000L;
long expectedLong = 1643341736L;
// test long value
writer.write(new LongWritable(testLong));
assertEquals(testWriter.getTimestamp(), expectedLong);
// test timestampV2 value
Timestamp ht = new Timestamp();
ht.setTimeInMillis(testWriter.getTimestamp());
TimestampWritableV2 tw2 = new TimestampWritableV2(ht);
writer.write(tw2);
assertEquals(testWriter.getTimestamp(), expectedLong);
}
Aggregations