julianhyde commented on a change in pull request #2458:
URL: https://github.com/apache/calcite/pull/2458#discussion_r675922927



##########
File path: 
core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java
##########
@@ -504,12 +518,16 @@ protected Builder buildAggregate(Aggregate e, Builder 
builder,
           SqlStdOperatorTable.ROLLUP.createCall(SqlParserPos.ZERO, groupKeys));
     default:
     case OTHER:
+      List<SqlNode> groupingSetsList = aggregate.getGroupSets().stream()
+          .map(groupSet -> groupItem(groupKeys, groupSet, 
aggregate.getGroupSet()))
+          .collect(Collectors.toList());
+      if (ImmutableBitSet.union(aggregate.getGroupSets()).cardinality()
+          != aggregate.getGroupSet().cardinality()) {
+        groupingSetsList.add(

Review comment:
       Good point. Strictly, that only applies to the `Aggregate.groupSets` 
data structure (list of `ImmutableBitSet`), not the `SqlNodeList`, but it's a 
good idea to follow the same pattern. I will make the change.




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


Reply via email to