liyafan82 commented on a change in pull request #2145:
URL: https://github.com/apache/calcite/pull/2145#discussion_r486839323



##########
File path: 
core/src/main/java/org/apache/calcite/rel/metadata/RelMdUniqueKeys.java
##########
@@ -246,8 +246,14 @@ private RelMdUniqueKeys() {}
 
   public Set<ImmutableBitSet> getUniqueKeys(Aggregate rel, RelMetadataQuery mq,
       boolean ignoreNulls) {
-    // group by keys form a unique key
-    return ImmutableSet.of(rel.getGroupSet());
+    if (Aggregate.isSimple(rel) || ignoreNulls) {
+      // group by keys form a unique key
+      return ImmutableSet.of(rel.getGroupSet());

Review comment:
       I see. Thanks for the clarification.

##########
File path: 
core/src/main/java/org/apache/calcite/rel/metadata/RelMdUniqueKeys.java
##########
@@ -246,8 +246,14 @@ private RelMdUniqueKeys() {}
 
   public Set<ImmutableBitSet> getUniqueKeys(Aggregate rel, RelMetadataQuery mq,
       boolean ignoreNulls) {
-    // group by keys form a unique key
-    return ImmutableSet.of(rel.getGroupSet());
+    if (Aggregate.isSimple(rel) || ignoreNulls) {
+      // group by keys form a unique key
+      return ImmutableSet.of(rel.getGroupSet());

Review comment:
       I see. Thanks for the clarification.




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


Reply via email to