jinxing64 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_r351665460
 
 

 ##########
 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:
   To be concrete, can we test condition `groupKeyList.isEmpty()` ?

----------------------------------------------------------------
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

Reply via email to