Skip to content

Commit

Permalink
Remove domain compaction from iceberg split source
Browse files Browse the repository at this point in the history
Compaction of domain before pushdown into iceberg is unnecessary
and potentially hinders pruning of metadata
  • Loading branch information
raunaqmorarka authored and wendigo committed Oct 1, 2024
1 parent 94d1b50 commit c08cc78
Showing 1 changed file with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
import static io.trino.plugin.iceberg.IcebergExceptions.translateMetadataException;
import static io.trino.plugin.iceberg.IcebergMetadataColumn.isMetadataColumnId;
import static io.trino.plugin.iceberg.IcebergSessionProperties.getSplitSize;
import static io.trino.plugin.iceberg.IcebergSplitManager.ICEBERG_DOMAIN_COMPACTION_THRESHOLD;
import static io.trino.plugin.iceberg.IcebergTypes.convertIcebergValueToTrino;
import static io.trino.plugin.iceberg.IcebergUtil.getColumnHandle;
import static io.trino.plugin.iceberg.IcebergUtil.getFileModifiedTimePathDomain;
Expand Down Expand Up @@ -220,17 +219,9 @@ private CompletableFuture<ConnectorSplitBatch> getNextBatchInternal(int maxSize)
this.pushedDownDynamicFilterPredicate = dynamicFilter.getCurrentPredicate()
.transformKeys(IcebergColumnHandle.class::cast)
.filter((columnHandle, domain) -> isConvertableToIcebergExpression(domain));
TupleDomain<IcebergColumnHandle> fullPredicate = tableHandle.getUnenforcedPredicate()
.intersect(pushedDownDynamicFilterPredicate);
// TODO: (https://github.com/trinodb/trino/issues/9743): Consider removing TupleDomain#simplify
TupleDomain<IcebergColumnHandle> simplifiedPredicate = fullPredicate.simplify(ICEBERG_DOMAIN_COMPACTION_THRESHOLD);
if (!simplifiedPredicate.equals(fullPredicate)) {
// Pushed down predicate was simplified, always evaluate it against individual splits
this.pushedDownDynamicFilterPredicate = TupleDomain.all();
}

TupleDomain<IcebergColumnHandle> effectivePredicate = dataColumnPredicate
.intersect(simplifiedPredicate);
TupleDomain<IcebergColumnHandle> effectivePredicate = TupleDomain.intersect(
ImmutableList.of(dataColumnPredicate, tableHandle.getUnenforcedPredicate(), pushedDownDynamicFilterPredicate));

if (effectivePredicate.isNone()) {
finish();
Expand Down

0 comments on commit c08cc78

Please sign in to comment.