Search in sources :

Example 1 with HivePartitionKey

use of io.prestosql.plugin.hive.HivePartitionKey in project boostkit-bigdata by kunpengcompute.

the class PageSourceUtil method buildColumn.

private static Column buildColumn(HiveColumnHandle columnHandle, TypeManager typeManager, List<HivePartitionKey> partitionKeys, OptionalInt bucketNumber, Path path) {
    Type columnType = typeManager.getType(columnHandle.getTypeSignature());
    if (!columnHandle.getColumnType().equals(PARTITION_KEY)) {
        return new Column(columnHandle.getHiveColumnIndex(), columnHandle.getColumnName(), columnType);
    }
    Map<String, HivePartitionKey> partitionKeysMap = uniqueIndex(partitionKeys, HivePartitionKey::getName);
    String prefilledValue = HiveUtil.getPrefilledColumnValue(columnHandle, partitionKeysMap.get(columnHandle.getName()), path, bucketNumber);
    Object columnValue = HiveUtil.typedPartitionKey(prefilledValue, columnType, prefilledValue);
    return new Column(columnHandle.getHiveColumnIndex(), columnHandle.getColumnName(), columnType, true, columnValue);
}
Also used : Type(io.prestosql.spi.type.Type) Column(com.huawei.boostkit.omnidata.model.Column) HivePartitionKey(io.prestosql.plugin.hive.HivePartitionKey)

Aggregations

Column (com.huawei.boostkit.omnidata.model.Column)1 HivePartitionKey (io.prestosql.plugin.hive.HivePartitionKey)1 Type (io.prestosql.spi.type.Type)1