Copilot commented on code in PR #16577:
URL: https://github.com/apache/pinot/pull/16577#discussion_r2269248321


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/validation/ArrayToMvValidationVisitor.java:
##########
@@ -79,14 +80,25 @@ public Void visitMailboxSend(MailboxSendNode node, Boolean 
isIntermediateStage)
 
   @Override
   public Void visitAggregate(AggregateNode node, Boolean isIntermediateStage) {
-    if (isIntermediateStage && containsArrayToMv(node.getAggCalls())) {
+    if (!isIntermediateStage) {
+      // No need to traverse underlying ProjectNode in leaf stage
+      return null;
+    }
+    if (containsArrayToMv(node.getAggCalls())) {
       throw new QueryException(QueryErrorCode.QUERY_PLANNING,
           "Function 'ArrayToMv' is not supported in AGGREGATE Intermediate 
Stage");
     }

Review Comment:
   The code accesses `columnDataTypes` array using `key` as index without 
validating that `node.getDataSchema()` is not null, which could result in a 
NullPointerException if the data schema is null.
   ```suggestion
       }
       if (node.getDataSchema() == null) {
         throw new QueryException(QueryErrorCode.QUERY_PLANNING,
             "AggregateNode has null DataSchema in intermediate stage");
       }
   ```



-- 
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]

Reply via email to