This is an automated email from the ASF dual-hosted git repository.
adarshsanjeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push:
new a134cc30a69 Change default inSubQueryThreshold (#15336)
a134cc30a69 is described below
commit a134cc30a6949dc378979d7110a535570d1a9075
Author: Adarsh Sanjeev <[email protected]>
AuthorDate: Tue Nov 14 14:08:12 2023 +0530
Change default inSubQueryThreshold (#15336)
---
docs/querying/query-context.md | 2 +-
.../java/org/apache/druid/query/QueryContexts.java | 2 +-
.../apache/druid/sql/calcite/CalciteQueryTest.java | 40 ----------------------
3 files changed, 2 insertions(+), 42 deletions(-)
diff --git a/docs/querying/query-context.md b/docs/querying/query-context.md
index 1ac3af1127c..0fd35d40320 100644
--- a/docs/querying/query-context.md
+++ b/docs/querying/query-context.md
@@ -66,7 +66,7 @@ Unless otherwise noted, the following parameters apply to all
query types.
|`debug`| `false` | Flag indicating whether to enable debugging outputs for
the query. When set to false, no additional logs will be produced (logs
produced will be entirely dependent on your logging level). When set to true,
the following addition logs will be produced:<br />- Log the stack trace of the
exception (if any) produced by the query |
|`setProcessingThreadNames`|`true`| Whether processing thread names will be
set to `queryType_dataSource_intervals` while processing a query. This aids in
interpreting thread dumps, and is on by default. Query overhead can be reduced
slightly by setting this to `false`. This has a tiny effect in most scenarios,
but can be meaningful in high-QPS, low-per-segment-processing-time scenarios. |
|`maxNumericInFilters`|`-1`|Max limit for the amount of numeric values that
can be compared for a string type dimension when the entire SQL WHERE clause of
a query translates only to an [OR](../querying/filters.md#or) of [Bound
filter](../querying/filters.md#bound-filter). By default, Druid does not
restrict the amount of of numeric Bound Filters on String columns, although
this situation may block other queries from running. Set this parameter to a
smaller value to prevent Druid from ru [...]
-|`inSubQueryThreshold`|`2147483647`| Threshold for minimum number of values in
an IN clause to convert the query to a JOIN operation on an inlined table
rather than a predicate. A threshold of 0 forces usage of an inline table in
all cases; a threshold of [Integer.MAX_VALUE] forces usage of OR in all cases. |
+|`inSubQueryThreshold`|`20`| Threshold for minimum number of values in an IN
clause to convert the query to a JOIN operation on an inlined table rather than
a predicate. A threshold of 0 forces usage of an inline table in all cases; a
threshold of [Integer.MAX_VALUE] forces usage of OR in all cases. |
## Druid SQL parameters
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 7d39edfde66..0948f951338 100644
--- a/processing/src/main/java/org/apache/druid/query/QueryContexts.java
+++ b/processing/src/main/java/org/apache/druid/query/QueryContexts.java
@@ -115,7 +115,7 @@ public class QueryContexts
public static final boolean DEFAULT_USE_FILTER_CNF = false;
public static final boolean DEFAULT_SECONDARY_PARTITION_PRUNING = true;
public static final boolean DEFAULT_ENABLE_DEBUG = false;
- public static final int DEFAULT_IN_SUB_QUERY_THRESHOLD = Integer.MAX_VALUE;
+ public static final int DEFAULT_IN_SUB_QUERY_THRESHOLD = 20;
public static final boolean DEFAULT_ENABLE_TIME_BOUNDARY_PLANNING = false;
@SuppressWarnings("unused") // Used by Jackson serialization
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 9ac6fd0aec6..6e996e46337 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
@@ -19,7 +19,6 @@
package org.apache.druid.sql.calcite;
-import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@@ -131,7 +130,6 @@ import org.junit.Ignore;
import org.junit.Test;
import org.junit.internal.matchers.ThrowableMessageMatcher;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
@@ -5269,44 +5267,6 @@ public class CalciteQueryTest extends
BaseCalciteQueryTest
);
}
- @Test
- public void testInFilterWith23Elements()
- {
- // Regression test for https://github.com/apache/druid/issues/4203.
- final List<String> elements = new ArrayList<>();
- elements.add("abc");
- elements.add("def");
- elements.add("ghi");
- for (int i = 0; i < 20; i++) {
- elements.add("dummy" + i);
- }
-
- final String elementsString = Joiner.on(",").join(elements.stream().map(s
-> "'" + s + "'").iterator());
-
- testQuery(
- "SELECT dim1, COUNT(*) FROM druid.foo WHERE dim1 IN (" +
elementsString + ") GROUP BY dim1",
- ImmutableList.of(
- GroupByQuery.builder()
- .setDataSource(CalciteTests.DATASOURCE1)
- .setInterval(querySegmentSpec(Filtration.eternity()))
- .setGranularity(Granularities.ALL)
- .setDimensions(dimensions(new
DefaultDimensionSpec("dim1", "d0")))
- .setDimFilter(new InDimFilter("dim1", elements, null))
- .setAggregatorSpecs(
- aggregators(
- new CountAggregatorFactory("a0")
- )
- )
- .setContext(QUERY_CONTEXT_DEFAULT)
- .build()
- ),
- ImmutableList.of(
- new Object[]{"abc", 1L},
- new Object[]{"def", 1L}
- )
- );
- }
-
@Test
public void testCountStarWithDegenerateFilter()
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]