Search in sources :

Example 6 with WritableTimestampObjectInspector

use of org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableTimestampObjectInspector 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);
}
Also used : HiveTimestampWriter(org.apache.drill.exec.store.hive.writers.primitive.HiveTimestampWriter) WritableTimestampObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableTimestampObjectInspector) LongWritable(org.apache.hadoop.io.LongWritable) Timestamp(org.apache.hadoop.hive.common.type.Timestamp) TimestampWritableV2(org.apache.hadoop.hive.serde2.io.TimestampWritableV2) Test(org.junit.Test)

Aggregations

DecimalTypeInfo (org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo)4 WritableTimestampObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableTimestampObjectInspector)3 VarcharTypeInfo (org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo)3 DecimalType (com.facebook.presto.common.type.DecimalType)2 VarcharType (com.facebook.presto.common.type.VarcharType)2 HiveChar (org.apache.hadoop.hive.common.type.HiveChar)2 HiveDecimal (org.apache.hadoop.hive.common.type.HiveDecimal)2 HiveVarchar (org.apache.hadoop.hive.common.type.HiveVarchar)2 ObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)2 PrimitiveCategory (org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory)2 StructObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector)2 WritableBooleanObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableBooleanObjectInspector)2 WritableByteObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableByteObjectInspector)2 WritableDateObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableDateObjectInspector)2 WritableDoubleObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableDoubleObjectInspector)2 WritableFloatObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableFloatObjectInspector)2 WritableHiveCharObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveCharObjectInspector)2 WritableHiveDecimalObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveDecimalObjectInspector)2 WritableHiveIntervalDayTimeObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveIntervalDayTimeObjectInspector)2 WritableHiveIntervalYearMonthObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveIntervalYearMonthObjectInspector)2