From b78e5f6bd79b4fe3913d99eb381ce3856c86f912 Mon Sep 17 00:00:00 2001 From: Raunaq Morarka Date: Thu, 26 Sep 2024 15:20:49 +0530 Subject: [PATCH] Remove domain compaction from iceberg split source Compaction of domain before pushdown into iceberg is unnecessary and potentially hinders pruning of metadata --- .../io/trino/plugin/iceberg/IcebergSplitSource.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergSplitSource.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergSplitSource.java index 262ca71b3d8f..e61e3b36a5ef 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergSplitSource.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergSplitSource.java @@ -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; @@ -220,17 +219,9 @@ private CompletableFuture getNextBatchInternal(int maxSize) this.pushedDownDynamicFilterPredicate = dynamicFilter.getCurrentPredicate() .transformKeys(IcebergColumnHandle.class::cast) .filter((columnHandle, domain) -> isConvertableToIcebergExpression(domain)); - TupleDomain fullPredicate = tableHandle.getUnenforcedPredicate() - .intersect(pushedDownDynamicFilterPredicate); - // TODO: (https://github.com/trinodb/trino/issues/9743): Consider removing TupleDomain#simplify - TupleDomain 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 effectivePredicate = dataColumnPredicate - .intersect(simplifiedPredicate); + TupleDomain effectivePredicate = TupleDomain.intersect( + ImmutableList.of(dataColumnPredicate, tableHandle.getUnenforcedPredicate(), pushedDownDynamicFilterPredicate)); if (effectivePredicate.isNone()) { finish();