jihoonson commented on a change in pull request #12195:
URL: https://github.com/apache/druid/pull/12195#discussion_r798973399
##########
File path:
sql/src/main/java/org/apache/druid/sql/calcite/planner/PlannerConfig.java
##########
@@ -190,6 +210,47 @@ public PlannerConfig withOverrides(final Map<String,
Object> context)
return newConfig;
}
+ private int validateMaxNumericInFilters(int queryContextMaxNumericInFilters,
int systemConfigMaxNumericInFilters)
+ {
+ // if maxNumericInFIlters through context == 0 catch exception
+ if (queryContextMaxNumericInFilters == 0) {
+ throw new UOE("[%s] must be greater than 0", CTX_MAX_NUMERIC_IN_FILTERS);
+ }
+ // if query context exceeds system set value throw error
+ else if (queryContextMaxNumericInFilters > systemConfigMaxNumericInFilters
+ && systemConfigMaxNumericInFilters != NUM_FILTER_NOT_USED) {
+ throw new UOE(String.format(
+ "Expected parameter[%s] cannot exceed system set value of [%d]",
+ CTX_MAX_NUMERIC_IN_FILTERS,
+ systemConfigMaxNumericInFilters
+ ));
+ }
+ // if system set value is not present, thereby inferring default of -1
+ if (systemConfigMaxNumericInFilters == NUM_FILTER_NOT_USED) {
+ return systemConfigMaxNumericInFilters;
+ }
Review comment:
Can you please add this behavior in the doc too? The doc should explain
that the query context is ignored when the system property is disabled.
##########
File path: docs/configuration/index.md
##########
@@ -1846,6 +1846,7 @@ The Druid SQL server is configured through the following
properties on the Broke
|`druid.sql.planner.metadataSegmentPollPeriod`|How often to poll coordinator
for published segments list if `druid.sql.planner.metadataSegmentCacheEnable`
is set to true. Poll period is in milliseconds. |60000|
|`druid.sql.planner.authorizeSystemTablesDirectly`|If true, Druid authorizes
queries against any of the system schema tables (`sys` in SQL) as
`SYSTEM_TABLE` resources which require `READ` access, in addition to
permissions based content filtering.|false|
|`druid.sql.planner.useNativeQueryExplain`|If true, `EXPLAIN PLAN FOR` will
return the explain plan as a JSON representation of equivalent native query(s),
else it will return the original version of explain plan generated by Calcite.
It can be overridden per query with `useNativeQueryExplain` context key.|false|
+|`druid.sql.planner.maxNumericInFilters`|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 to an [IN
filter](../querying/filters.md#in-filter). By default, Druid does not restrict
the amount of numbers in an IN filter, although this situation may block other
queries from running. Set this property to a smaller value to prevent Druid
from running queries that have prohibitively long segment processing times. The
optimal limit requires some trial and error; we recommend starting with 100.
Users who submit a query that exceeds the limit of `maxNumericInFilters` should
instead rewrite their queries to use strings in the IN filter instead of
numbers. For example, `WHERE someString IN (‘123’, ‘456’)`.|`-1`|
Review comment:
```suggestion
|`druid.sql.planner.maxNumericInFilters`|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 to an [IN
filter](../querying/filters.md#in-filter). By default, Druid does not restrict
the amount of numbers in an IN filter, although this situation may block other
queries from running. Set this property to a smaller value to prevent Druid
from running queries that have prohibitively long segment processing times. The
optimal limit requires some trial and error; we recommend starting with 100.
Users who submit a query that exceeds the limit of `maxNumericInFilters` should
instead rewrite their queries to use strings in the IN filter instead of
numbers. For example, `WHERE someString IN (‘123’, ‘456’)`.|`-1` (disabled)|
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]