Search in sources :

Example 1 with MetadataColumns

use of org.apache.iceberg.MetadataColumns in project iceberg by apache.

the class SparkScanBuilder method pruneColumns.

@Override
public void pruneColumns(StructType requestedSchema) {
    StructType requestedProjection = new StructType(Stream.of(requestedSchema.fields()).filter(field -> MetadataColumns.nonMetadataColumn(field.name())).toArray(StructField[]::new));
    // the projection should include all columns that will be returned, including those only used in filters
    this.schema = SparkSchemaUtil.prune(schema, requestedProjection, filterExpression(), caseSensitive);
    Stream.of(requestedSchema.fields()).map(StructField::name).filter(MetadataColumns::isMetadataColumn).distinct().forEach(metaColumns::add);
}
Also used : StructField(org.apache.spark.sql.types.StructField) StructType(org.apache.spark.sql.types.StructType) MetadataColumns(org.apache.iceberg.MetadataColumns)

Aggregations

MetadataColumns (org.apache.iceberg.MetadataColumns)1 StructField (org.apache.spark.sql.types.StructField)1 StructType (org.apache.spark.sql.types.StructType)1