yashmayya commented on code in PR #16577:
URL: https://github.com/apache/pinot/pull/16577#discussion_r2269286394
##########
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:
```suggestion
"Multi-valued columns are not supported as a grouping key in the
intermediate stage. "
```
nit
##########
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 follow this. In the sample query you've shared, isn't the grouping a
leaf stage one?
```
SELECT count(*)
FROM mytable
GROUP BY RandomAirports
```
--
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]