ILuffZhe commented on code in PR #4099:
URL: https://github.com/apache/calcite/pull/4099#discussion_r1891123328


##########
core/src/main/java/org/apache/calcite/rel/metadata/RelMdUtil.java:
##########
@@ -210,6 +210,18 @@ public static boolean 
areColumnsDefinitelyUnique(RelMetadataQuery mq,
     return b != null && b;
   }
 
+  public static boolean isRelDefinitelyEmpty(RelMetadataQuery mq,
+      RelNode rel) {
+    Boolean b = mq.isEmpty(rel);
+    return b != null && b;
+  }
+
+  public static boolean isRelDefinitelyNotEmpty(RelMetadataQuery mq,

Review Comment:
   Can this method be replaced by "!isRelDefinitelyEmpty"?



##########
core/src/main/java/org/apache/calcite/tools/RelBuilder.java:
##########
@@ -2678,10 +2679,7 @@ private boolean alreadyUnique(List<AggCallPlus> 
aggCallList,
       List<RexNode> extraNodes) {
     final RelMetadataQuery mq = peek().getCluster().getMetadataQuery();
     if (aggCallList.isEmpty() && groupSet.isEmpty()) {
-      final Double minRowCount = mq.getMinRowCount(peek());
-      if (minRowCount == null || minRowCount < 1d) {
-        // We can't remove "GROUP BY ()" if there's a chance the rel could be

Review Comment:
   Why delete the doc?



##########
core/src/main/java/org/apache/calcite/rel/metadata/RelMetadataQuery.java:
##########
@@ -305,6 +305,26 @@ public static RelMetadataQuery instance() {
     }
   }
 
+  /**
+   * Returns whether the return rows of a given relational expression are 
empty.

Review Comment:
   nit: "a given relational expression is empty"



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