weidong3630 commented on a change in pull request #1606: [CALCITE-3466] Do not
drop the "group by" clause of subquery in a select statement with "group by"
clause in JDBC adapter.
URL: https://github.com/apache/calcite/pull/1606#discussion_r358241126
##########
File path:
core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java
##########
@@ -259,7 +259,7 @@ private Result visitAggregate(Aggregate e, List<Integer>
groupKeyList) {
// "select a, b, sum(x) from ( ... ) group by a, b"
final Result x = visitChild(0, e.getInput());
final Builder builder;
- if (e.getInput() instanceof Project) {
+ if ((e.getInput() instanceof Project) && (groupKeyList.isEmpty() ||
!x.withGroupBy())) {
Review comment:
Pr has been updated, would you like to review it for me?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services