JackieTien97 commented on code in PR #17843:
URL: https://github.com/apache/iotdb/pull/17843#discussion_r3372264445
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java:
##########
@@ -2706,6 +2799,7 @@ private Analysis.GroupingSetAnalysis analyzeGroupBy(
column = outputExpressions.get(toIntExact(ordinal - 1));
verifyNoAggregateWindowOrGroupingFunctions(column, "GROUP BY
clause");
} else {
+ column = resolveGroupBySelectAlias(column, scope,
selectAliases);
Review Comment:
Could we apply this same alias-resolution step to the `GroupingSets` branch
below as well? Right now only `SimpleGroupBy` rewrites SELECT aliases, so
queries such as `SELECT s1 AS x, COUNT(*) FROM table1 GROUP BY ROLLUP(x)` still
reach `analyzeExpression(column, scope)` with `x` unresolved and fail with
`Column 'x' cannot be resolved`. Since `ROLLUP`, `CUBE`, and `GROUPING SETS`
are still `GROUP BY` grouping elements, they should follow the same
input-column precedence and SELECT-alias fallback rule.
--
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]