DonnyZone commented on a change in pull request #1756: [CALCITE-1824] GROUP_ID returns wrong result URL: https://github.com/apache/calcite/pull/1756#discussion_r366246964
########## File path: core/src/main/java/org/apache/calcite/sql/validate/AggregatingSelectScope.java ########## @@ -110,8 +111,11 @@ private Resolved resolve() { final Set<ImmutableBitSet> flatGroupSets = Sets.newTreeSet(ImmutableBitSet.COMPARATOR); + final Map<ImmutableBitSet, Integer> groupSetCount = new HashMap<>(); for (List<ImmutableBitSet> groupSet : Linq4j.product(builder.build())) { - flatGroupSets.add(ImmutableBitSet.union(groupSet)); + final ImmutableBitSet set = ImmutableBitSet.union(groupSet); + groupSetCount.put(set, groupSetCount.getOrDefault(set, 0) + 1); + flatGroupSets.add(set); Review comment: I agree. We can unify HashMap and the sorted Set as TreeMap. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services