From 53948380305d8495285aa6db2f49e6348d57049f Mon Sep 17 00:00:00 2001 From: Rohan Garg <7731512+rohangarg@users.noreply.github.com> Date: Sat, 13 Aug 2022 20:37:43 +0530 Subject: [PATCH] Enable conversion of join to filter by default (#12868) --- docs/querying/query-context.md | 1 + .../src/main/java/org/apache/druid/query/QueryContexts.java | 2 +- .../java/org/apache/druid/sql/calcite/CalciteQueryTest.java | 3 --- website/.spelling | 1 + 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/querying/query-context.md b/docs/querying/query-context.md index bded042ecb5..5a4b2fc6414 100644 --- a/docs/querying/query-context.md +++ b/docs/querying/query-context.md @@ -93,6 +93,7 @@ Some query types offer context parameters specific to that query type. |enableJoinFilterPushDown | `true` | Controls whether a join query will attempt filter push down, which reduces the number of rows that have to be compared in a join operation.| |enableJoinFilterRewrite | `true` | Controls whether filter clauses that reference non-base table columns will be rewritten into filters on base table columns.| |enableJoinFilterRewriteValueColumnFilters | `false` | Controls whether Druid rewrites non-base table filters on non-key columns in the non-base table. Requires a scan of the non-base table.| +|enableRewriteJoinToFilter | `true` | Controls whether a join can be pushed partial or fully to the base table as a filter at runtime.| |joinFilterRewriteMaxSize | `10000` | The maximum size of the correlated value set used for filter rewrites. Set this limit to prevent excessive memory use.| ### GroupBy diff --git a/processing/src/main/java/org/apache/druid/query/QueryContexts.java b/processing/src/main/java/org/apache/druid/query/QueryContexts.java index e531869ac5d..416760cb43b 100644 --- a/processing/src/main/java/org/apache/druid/query/QueryContexts.java +++ b/processing/src/main/java/org/apache/druid/query/QueryContexts.java @@ -95,7 +95,7 @@ public class QueryContexts public static final boolean DEFAULT_ENABLE_JOIN_FILTER_PUSH_DOWN = true; public static final boolean DEFAULT_ENABLE_JOIN_FILTER_REWRITE = true; public static final boolean DEFAULT_ENABLE_JOIN_FILTER_REWRITE_VALUE_COLUMN_FILTERS = false; - public static final boolean DEFAULT_ENABLE_REWRITE_JOIN_TO_FILTER = false; + public static final boolean DEFAULT_ENABLE_REWRITE_JOIN_TO_FILTER = true; public static final long DEFAULT_ENABLE_JOIN_FILTER_REWRITE_MAX_SIZE = 10000; public static final boolean DEFAULT_ENABLE_SQL_JOIN_LEFT_SCAN_DIRECT = false; public static final boolean DEFAULT_USE_FILTER_CNF = false; diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java index 39e5dcd799b..1b3f2ce21bc 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java @@ -3843,9 +3843,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest @Test public void testGroupingWithNullInFilter() throws Exception { - // HashJoinSegmentStorageAdapter is not vectorizable - cannotVectorize(); - testQuery( "SELECT COUNT(*) FROM foo WHERE dim1 IN (NULL)", ImmutableList.of( diff --git a/website/.spelling b/website/.spelling index 52ed82098c2..ad1ccc318b5 100644 --- a/website/.spelling +++ b/website/.spelling @@ -1652,6 +1652,7 @@ enableParallelMerge enableJoinLeftTableScanDirect enableJoinFilterPushDown enableJoinFilterRewrite +enableRewriteJoinToFilter enableJoinFilterRewriteValueColumnFilters floatSum joinFilterRewriteMaxSize