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



##########
File path: 
core/src/main/java/org/apache/calcite/rel/metadata/RelMdColumnUniqueness.java
##########
@@ -348,10 +348,13 @@ public Boolean areColumnsUnique(Join rel, 
RelMetadataQuery mq,
 
   public Boolean areColumnsUnique(Aggregate rel, RelMetadataQuery mq,
       ImmutableBitSet columns, boolean ignoreNulls) {
-    columns = decorateWithConstantColumnsFromPredicates(columns, rel, mq);
-    // group by keys form a unique key
-    ImmutableBitSet groupKey = ImmutableBitSet.range(rel.getGroupCount());
-    return columns.contains(groupKey);
+    if (Aggregate.isSimple(rel) || ignoreNulls) {
+      columns = decorateWithConstantColumnsFromPredicates(columns, rel, mq);
+      // group by keys form a unique key
+      ImmutableBitSet groupKey = ImmutableBitSet.range(rel.getGroupCount());
+      return columns.contains(groupKey);
+    }
+    return false;

Review comment:
       should we return false or null?




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


Reply via email to