Search in sources :

Example 16 with LongTimestamp

use of io.trino.spi.type.LongTimestamp in project trino by trinodb.

the class GenericHiveRecordCursor method parseObjectColumn.

private void parseObjectColumn(int column) {
    loaded[column] = true;
    Object fieldData = rowInspector.getStructFieldData(rowData, structFields[column]);
    if (fieldData == null) {
        nulls[column] = true;
    } else {
        Type type = types[column];
        if (type.getJavaType() == Block.class) {
            objects[column] = getBlockObject(type, fieldData, fieldInspectors[column]);
        } else if (type instanceof TimestampType) {
            Timestamp timestamp = (Timestamp) ((PrimitiveObjectInspector) fieldInspectors[column]).getPrimitiveJavaObject(fieldData);
            objects[column] = longTimestamp(timestamp, column);
        } else {
            throw new IllegalStateException("Unsupported type: " + type);
        }
        nulls[column] = false;
    }
}
Also used : DecimalType(io.trino.spi.type.DecimalType) Type(io.trino.spi.type.Type) TimestampType(io.trino.spi.type.TimestampType) VarcharType(io.trino.spi.type.VarcharType) CharType(io.trino.spi.type.CharType) HiveUtil.isStructuralType(io.trino.plugin.hive.util.HiveUtil.isStructuralType) TimestampType(io.trino.spi.type.TimestampType) SerDeUtils.getBlockObject(io.trino.plugin.hive.util.SerDeUtils.getBlockObject) PrimitiveObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector) DecodedTimestamp(io.trino.plugin.base.type.DecodedTimestamp) Timestamp(org.apache.hadoop.hive.common.type.Timestamp) LongTimestamp(io.trino.spi.type.LongTimestamp)

Aggregations

LongTimestamp (io.trino.spi.type.LongTimestamp)16 BlockBuilder (io.trino.spi.block.BlockBuilder)4 CharType (io.trino.spi.type.CharType)4 Type (io.trino.spi.type.Type)4 VarcharType (io.trino.spi.type.VarcharType)4 Test (org.testng.annotations.Test)4 ImmutableList (com.google.common.collect.ImmutableList)3 DecimalType (io.trino.spi.type.DecimalType)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 Slice (io.airlift.slice.Slice)2 ArrayType (io.trino.spi.type.ArrayType)2 TimestampType (io.trino.spi.type.TimestampType)2 VarbinaryType (io.trino.spi.type.VarbinaryType)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 MoreObjects.toStringHelper (com.google.common.base.MoreObjects.toStringHelper)1 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 Slices.utf8Slice (io.airlift.slice.Slices.utf8Slice)1