LakshSingla commented on a change in pull request #12195:
URL: https://github.com/apache/druid/pull/12195#discussion_r791173507
##########
File path:
sql/src/main/java/org/apache/druid/sql/calcite/run/NativeQueryMaker.java
##########
@@ -122,6 +125,24 @@ public boolean feature(QueryFeature feature)
);
}
}
+ int numFilters =
plannerContext.getPlannerConfig().getMaxNumericInFilters();
+ if (numFilters < 1) {
Review comment:
Can this validation be moved somehow outside the `NativeQueryMaker`,
since this is not specific to runQuery, but to when the `PlannerConfig` gets
generated? There can be 2 cases to it:
1. When overriding incorrectly in the specific query (i.e.
`PlannerConfig#withOverrides` method)
2. When passing the incorrect value as
`druid.sql.planner.maxNumericInFilter` -> Not sure how to achieve this since we
can't validate @JsonProperty I think.
Let me know wdyt about moving this check elsewhere?
##########
File path: sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java
##########
@@ -6903,6 +6903,27 @@ public void testMaxSubqueryRows() throws Exception
);
}
+ @Test
+ public void testZeroMaxNumericInFilter() throws Exception
Review comment:
W.r.t tests, following case can also be helpful: when the number of IN
filters in the query are greater than the MAX_NUMERIC_IN_FILTERS.
##########
File path:
sql/src/main/java/org/apache/druid/sql/calcite/run/NativeQueryMaker.java
##########
@@ -122,6 +125,24 @@ public boolean feature(QueryFeature feature)
);
}
}
+ int numFilters =
plannerContext.getPlannerConfig().getMaxNumericInFilters();
+ if (numFilters < 1) {
+ throw new CannotBuildQueryException("maxNumericInFilters must be greater
than 0");
Review comment:
Is it helpful to add a hint using `PlannerContext#setPlanningError`
here? I don't see any usages of that in the `NativeQueryMaker` so I might be
wrong.
--
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]