From 48878999ec8e2c44c3a14c3e799e352aadc39681 Mon Sep 17 00:00:00 2001 From: SURYA SUMANTH N Date: Tue, 5 Oct 2021 14:58:24 +0530 Subject: [PATCH] Fix Creation of Dynamic Filters Issue when ORC Predicate Pushdown is enabled --- .../sql/presto/tpcds/q67.push.plan.txt | 28 +++++++++---------- .../io/prestosql/cost/TableScanStatsRule.java | 2 +- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/presto-benchto-benchmarks/src/test/resources/sql/presto/tpcds/q67.push.plan.txt b/presto-benchto-benchmarks/src/test/resources/sql/presto/tpcds/q67.push.plan.txt index 2df681bdc..155b15683 100644 --- a/presto-benchto-benchmarks/src/test/resources/sql/presto/tpcds/q67.push.plan.txt +++ b/presto-benchto-benchmarks/src/test/resources/sql/presto/tpcds/q67.push.plan.txt @@ -6,19 +6,17 @@ local exchange (GATHER, SINGLE, []) local exchange (REPARTITION, HASH, ["d_moy$gid", "d_qoy$gid", "d_year$gid", "groupid", "i_brand$gid", "i_category$gid", "i_class$gid", "i_product_name$gid", "s_store_id$gid"]) remote exchange (REPARTITION, HASH, ["d_moy$gid", "d_qoy$gid", "d_year$gid", "groupid", "i_brand$gid", "i_category$gid", "i_class$gid", "i_product_name$gid", "s_store_id$gid"]) partial hashaggregation over (d_moy$gid, d_qoy$gid, d_year$gid, groupid, i_brand$gid, i_category$gid, i_class$gid, i_product_name$gid, s_store_id$gid) - local exchange (REPARTITION, HASH, ["i_brand", "i_category", "i_class", "i_product_name"]) - remote exchange (REPARTITION, HASH, ["i_brand", "i_category", "i_class", "i_product_name"]) - join (INNER, PARTITIONED): - remote exchange (REPARTITION, HASH, ["ss_item_sk"]) - join (INNER, REPLICATED): - join (INNER, REPLICATED): - scan store_sales - local exchange (GATHER, SINGLE, []) - remote exchange (REPLICATE, BROADCAST, []) - scan date_dim (pushdown = true) - local exchange (GATHER, SINGLE, []) - remote exchange (REPLICATE, BROADCAST, []) - scan store + join (INNER, PARTITIONED): + remote exchange (REPARTITION, HASH, ["ss_item_sk"]) + join (INNER, REPLICATED): + join (INNER, REPLICATED): + scan store_sales + local exchange (GATHER, SINGLE, []) + remote exchange (REPLICATE, BROADCAST, []) + scan date_dim (pushdown = true) local exchange (GATHER, SINGLE, []) - remote exchange (REPARTITION, HASH, ["i_item_sk"]) - scan item + remote exchange (REPLICATE, BROADCAST, []) + scan store + local exchange (GATHER, SINGLE, []) + remote exchange (REPARTITION, HASH, ["i_item_sk"]) + scan item diff --git a/presto-main/src/main/java/io/prestosql/cost/TableScanStatsRule.java b/presto-main/src/main/java/io/prestosql/cost/TableScanStatsRule.java index dcd6dd912..62353fed9 100644 --- a/presto-main/src/main/java/io/prestosql/cost/TableScanStatsRule.java +++ b/presto-main/src/main/java/io/prestosql/cost/TableScanStatsRule.java @@ -81,7 +81,7 @@ public class TableScanStatsRule Map assignments = ImmutableBiMap.copyOf(node.getAssignments()).inverse(); boolean isPredicatesPushDown = false; - if (predicate.isAll() + if ((predicate.isAll() || predicate.getDomains().get().equals(node.getEnforcedConstraint().getDomains().get())) && !(node.getEnforcedConstraint().isAll() || node.getEnforcedConstraint().isNone())) { predicate = node.getEnforcedConstraint(); isPredicatesPushDown = true;