You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/01/24 21:51:35 UTC

[GitHub] [druid] LakshSingla commented on a change in pull request #12195: Moving in filter check to broker

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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org