alex-plekhanov commented on code in PR #11547:
URL: https://github.com/apache/ignite/pull/11547#discussion_r2025046539


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessor.java:
##########
@@ -530,23 +531,28 @@ private <T> List<T> parseAndProcessQuery(
 
         List<T> res = new ArrayList<>(qryList.size());
         List<RootQuery<Object[]>> qrys = new ArrayList<>(qryList.size());
+        int qryIdx = 0;
 
         for (final SqlNode sqlNode: qryList) {
+            int qryIdx0 = qryIdx;

Review Comment:
   Looks like it's enough to validate count of parameters just after parsing: 
Something like:
   ```
           int[] maxDynParam = new int[] {-1};
   
           qryList.accept(new SqlShuttle() {
               @Override public SqlNode visit(SqlDynamicParam param) {
                   if (param.getIndex() > maxDynParam[0])
                       maxDynParam[0] = param.getIndex();
   
                   return param;
               }
           });
   
           int paramsCnt = params == null ? 0 : params.length;
   
           if (paramsCnt != maxDynParam[0] + 1)
               throw new IgniteSQLException("Wrong number of query 
parameters...", IgniteQueryErrorCode.PARSING);
   ```
   And no need to change Validator and pass additional parameters to Query, 
PlanningContext, etc.
   



-- 
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: notifications-unsubscr...@ignite.apache.org

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

Reply via email to