englefly commented on code in PR #18784:
URL: https://github.com/apache/doris/pull/18784#discussion_r1196253606
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java:
##########
@@ -464,6 +478,32 @@ private Statistics computeTopN(TopN topN) {
return stats.withRowCount(Math.min(stats.getRowCount(),
topN.getLimit()));
}
+ private Statistics computePartitionTopN(PartitionTopN partitionTopN) {
+ Statistics stats = groupExpression.childStatistics(0);
+ double rowCount = stats.getRowCount();
+ List<Expression> partitionKeys = partitionTopN.getPartitionKeys();
+ if (!partitionTopN.hasGlobalLimit() && !partitionKeys.isEmpty()) {
Review Comment:
`select * from (select * ,rank() over(partition by b order by a) as num
from t ) tt where num < 10;`
rank() column stats should be set manually, its max is 10. And hence, outer
filter `num<10` selectivity is 1.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]