NobiGo commented on code in PR #4459:
URL: https://github.com/apache/calcite/pull/4459#discussion_r2191404200


##########
core/src/main/java/org/apache/calcite/rel/metadata/RelMdDistinctRowCount.java:
##########
@@ -172,12 +172,18 @@ protected RelMdDistinctRowCount() {}
         return 1D;
       }
     }
+    // the result of the aggregation function is difficult to infer, so if the 
groupKey contains
+    // the aggregated column, return the full row count of Aggregate. This is 
the most conservative
+    // estimate, and the actual ndv will not be greater than it.
+    if (groupKey.anyMatch(key -> key >= rel.getGroupCount())) {

Review Comment:
   I didn't understand the changes here, but the test cases are good for me.



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