Search in sources :

Example 1 with PrimitiveConverter

use of org.apache.parquet.io.api.PrimitiveConverter in project hive by apache.

the class TestETypeConverter method testTimestampInt96ConverterChicago.

@Test
public void testTimestampInt96ConverterChicago() {
    PrimitiveConverter converter;
    parent.metadata.put(ParquetTableUtils.PARQUET_INT96_WRITE_ZONE_PROPERTY, "America/Chicago");
    converter = getETypeConverter(parent, PrimitiveTypeName.INT96, TypeInfoFactory.timestampTypeInfo);
    converter.addBinary(NanoTimeUtils.getNanoTime(ts, Calendar.getInstance(TimeZone.getTimeZone("America/Chicago"))).toBinary());
    parent.assertWritableValue(new TimestampWritable(ts));
}
Also used : PrimitiveConverter(org.apache.parquet.io.api.PrimitiveConverter) TimestampWritable(org.apache.hadoop.hive.serde2.io.TimestampWritable) Test(org.junit.Test)

Example 2 with PrimitiveConverter

use of org.apache.parquet.io.api.PrimitiveConverter in project hive by apache.

the class TestETypeConverter method testTimestampInt96ConverterEtc.

@Test
public void testTimestampInt96ConverterEtc() {
    PrimitiveConverter converter;
    parent.metadata.put(ParquetTableUtils.PARQUET_INT96_WRITE_ZONE_PROPERTY, "Etc/GMT-12");
    converter = getETypeConverter(parent, PrimitiveTypeName.INT96, TypeInfoFactory.timestampTypeInfo);
    converter.addBinary(NanoTimeUtils.getNanoTime(ts, Calendar.getInstance(TimeZone.getTimeZone("Etc/GMT-12"))).toBinary());
    parent.assertWritableValue(new TimestampWritable(ts));
}
Also used : PrimitiveConverter(org.apache.parquet.io.api.PrimitiveConverter) TimestampWritable(org.apache.hadoop.hive.serde2.io.TimestampWritable) Test(org.junit.Test)

Example 3 with PrimitiveConverter

use of org.apache.parquet.io.api.PrimitiveConverter in project hive by apache.

the class TestETypeConverter method testTimestampInt96ConverterGMT.

@Test
public void testTimestampInt96ConverterGMT() {
    PrimitiveConverter converter;
    parent.metadata.put(ParquetTableUtils.PARQUET_INT96_WRITE_ZONE_PROPERTY, "GMT");
    converter = getETypeConverter(parent, PrimitiveTypeName.INT96, TypeInfoFactory.timestampTypeInfo);
    converter.addBinary(NanoTimeUtils.getNanoTime(ts, Calendar.getInstance(TimeZone.getTimeZone("GMT"))).toBinary());
    parent.assertWritableValue(new TimestampWritable(ts));
}
Also used : PrimitiveConverter(org.apache.parquet.io.api.PrimitiveConverter) TimestampWritable(org.apache.hadoop.hive.serde2.io.TimestampWritable) Test(org.junit.Test)

Example 4 with PrimitiveConverter

use of org.apache.parquet.io.api.PrimitiveConverter in project hive by apache.

the class TestETypeConverter method testTimestampInt96ConverterLocal.

@Test
public void testTimestampInt96ConverterLocal() {
    PrimitiveConverter converter;
    // Default timezone should be Localtime
    converter = getETypeConverter(parent, PrimitiveTypeName.INT96, TypeInfoFactory.timestampTypeInfo);
    converter.addBinary(NanoTimeUtils.getNanoTime(ts, Calendar.getInstance()).toBinary());
    parent.assertWritableValue(new TimestampWritable(ts));
}
Also used : PrimitiveConverter(org.apache.parquet.io.api.PrimitiveConverter) TimestampWritable(org.apache.hadoop.hive.serde2.io.TimestampWritable) Test(org.junit.Test)

Aggregations

TimestampWritable (org.apache.hadoop.hive.serde2.io.TimestampWritable)4 PrimitiveConverter (org.apache.parquet.io.api.PrimitiveConverter)4 Test (org.junit.Test)4