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


##########
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");
     }
-    if (isIntermediateStage) {
-      node.getInputs().forEach(e -> e.visit(this, true));
+    DataSchema.ColumnDataType[] columnDataTypes = 
node.getDataSchema().getColumnDataTypes();
+    for (Integer key : node.getGroupKeys()) {
+      if (key >= 0 && key < columnDataTypes.length
+          && columnDataTypes[key] != null
+          && columnDataTypes[key].isArray()) {
+        throw new QueryException(QueryErrorCode.QUERY_PLANNING,
+            "Multi-values are not supported as a grouping key in the 
intermediate stage. "

Review Comment:
   Right I get that, but doesn't that mean purely leaf stage aggregations 
aren't really possible? Or does grouping by MV columns work without 
`ARRAY_TO_MV` if using something like the `is_partitioned_by_group_by_keys` 
hint explicitly? Is that documented?



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