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);
}
Aggregations