rubenada commented on code in PR #6523:
URL: https://github.com/apache/hive/pull/6523#discussion_r3612825845


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRelFieldTrimmer.java:
##########
@@ -517,7 +517,8 @@ private ImmutableBitSet generateNewGroupset(Aggregate 
aggregate, ImmutableBitSet
     RelMetadataQuery mq = aggregate.getCluster().getMetadataQuery();
 
     final Set<ImmutableBitSet> uniqueKeys = mq.getUniqueKeys(input, false);
-    if (uniqueKeys == null || uniqueKeys.isEmpty()) {
+    if (uniqueKeys == null || uniqueKeys.isEmpty() ||
+        (uniqueKeys.size() == 1 && uniqueKeys.iterator().next().isEmpty())) {

Review Comment:
   Thanks for the feedback. I've changed this code to separate the logic: we 
must not remove all the group columns (if we do so we risk altering the 
semantics of the aggregation)



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

Reply via email to