tarun11Mavani commented on code in PR #13792:
URL: https://github.com/apache/pinot/pull/13792#discussion_r1722666098
##########
pinot-common/src/main/java/org/apache/pinot/sql/parsers/rewriter/NonAggregationGroupByToDistinctQueryRewriter.java:
##########
@@ -85,9 +85,7 @@ public PinotQuery rewrite(PinotQuery pinotQuery) {
pinotQuery.setGroupByList(null);
return pinotQuery;
} else {
- throw new SqlCompilationException(String.format(
- "For non-aggregation group-by query, select expression set and
group-by expression set should be the same. "
- + "Found select: %s, group-by: %s", selectExpressions,
groupByExpressions));
+ return pinotQuery;
Review Comment:
This query will fail in such cases due to a validation process that occurs
immediately after all rewrites are completed in the
[CalciteSqlParser](https://github.com/apache/pinot/blob/53fbf88027c47b3c6f7d1526576ba0bd257fe9d5/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java#L550).
Specifically, the
[validateGroupByClause](https://github.com/apache/pinot/blob/53fbf88027c47b3c6f7d1526576ba0bd257fe9d5/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java#L550)
function is invoked to recursively check whether an expression contains any
references that are not included in the GROUP BY clause. As a result, there is
no need to perform this verification in the
NonAggregationGroupByToDistinctQueryRewriter.
--
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]