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


##########
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:
   Here is to solve the issue mentioned in jira:
   > when determining the pushable predicates, it makes the assumption that the 
aggregate group key is a zero-based range, which is not necessarily the case 
(the indices in the aggregate group key are the child indices, the predicates 
are expressed in terms of the zero-based output range).
   
   I have given an example in jira.



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