Search in sources :

Example 6 with HiveColumnHandle

use of com.facebook.presto.hive.HiveColumnHandle in project presto by prestodb.

the class ParquetPredicateUtils method buildParquetPredicate.

public static ParquetPredicate buildParquetPredicate(List<HiveColumnHandle> columns, TupleDomain<HiveColumnHandle> effectivePredicate, MessageType fileSchema, TypeManager typeManager) {
    ImmutableList.Builder<ColumnReference<HiveColumnHandle>> columnReferences = ImmutableList.builder();
    for (HiveColumnHandle column : columns) {
        if (!column.isPartitionKey()) {
            int parquetFieldIndex = lookupParquetColumn(column, fileSchema);
            Type type = typeManager.getType(column.getTypeSignature());
            columnReferences.add(new ColumnReference<>(column, parquetFieldIndex, type));
        }
    }
    return new TupleDomainParquetPredicate<>(effectivePredicate, columnReferences.build());
}
Also used : PageType(parquet.format.PageType) Type(com.facebook.presto.spi.type.Type) MessageType(parquet.schema.MessageType) ImmutableList(com.google.common.collect.ImmutableList) HiveColumnHandle(com.facebook.presto.hive.HiveColumnHandle) ColumnReference(com.facebook.presto.hive.parquet.predicate.TupleDomainParquetPredicate.ColumnReference)

Aggregations

HiveColumnHandle (com.facebook.presto.hive.HiveColumnHandle)6 PrestoException (com.facebook.presto.spi.PrestoException)4 Type (com.facebook.presto.spi.type.Type)4 ImmutableList (com.google.common.collect.ImmutableList)4 IOException (java.io.IOException)4 FileSystem (org.apache.hadoop.fs.FileSystem)4 MessageType (parquet.schema.MessageType)3 HdfsEnvironment (com.facebook.presto.hive.HdfsEnvironment)2 REGULAR (com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR)2 HIVE_CANNOT_OPEN_SPLIT (com.facebook.presto.hive.HiveErrorCode.HIVE_CANNOT_OPEN_SPLIT)2 HIVE_MISSING_DATA (com.facebook.presto.hive.HiveErrorCode.HIVE_MISSING_DATA)2 HdfsParquetDataSource.buildHdfsParquetDataSource (com.facebook.presto.hive.parquet.HdfsParquetDataSource.buildHdfsParquetDataSource)2 ParquetTypeUtils.getParquetType (com.facebook.presto.hive.parquet.ParquetTypeUtils.getParquetType)2 ParquetPredicate (com.facebook.presto.hive.parquet.predicate.ParquetPredicate)2 ParquetPredicateUtils.buildParquetPredicate (com.facebook.presto.hive.parquet.predicate.ParquetPredicateUtils.buildParquetPredicate)2 ParquetPredicateUtils.predicateMatches (com.facebook.presto.hive.parquet.predicate.ParquetPredicateUtils.predicateMatches)2 TupleDomain (com.facebook.presto.spi.predicate.TupleDomain)2 TypeManager (com.facebook.presto.spi.type.TypeManager)2 String.format (java.lang.String.format)2 List (java.util.List)2