gortiz commented on code in PR #16577:
URL: https://github.com/apache/pinot/pull/16577#discussion_r2269776580
##########
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:
I don't think this implies that.
This visitor visits the dispatcher plan, which means that the received plan
is the one that will be sent to the servers. Here we can check whether the node
we are visiting belongs to an intermediate stage or not. And here we only fail
if the aggregate belongs to an intermediate stage _and_ one of their grouping
keys is of multivalued type.
In cases the optimizer removes the final aggregate (independently on whether
it was due to a hint or any other reason) the plan will only contain the
distributed partitioned aggregate, which may be executed in a leaf stage and
therefore should not fail here.
--
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]