github-actions[bot] commented on code in PR #70891:
URL: https://github.com/apache/doris/pull/70891#discussion_r4665918627


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java:
##########
@@ -659,6 +662,11 @@ public Statistics computeOlapScan(OlapScan olapScan) {
             }
             checkIfUnknownStatsUsedAsKey(builder);
             builder.setRowCount(selectedPartitionsRowCount);
+            Statistics selectedStats = computeVirtualColumnStats(olapScan, 
builder.build());

Review Comment:
   [P1] Preserve proofs when pruning keeps every partition.
   
   A partition predicate can be proven true for every LIST partition while the 
selected partition count remains equal to partitionNum; PruneOlapScanPartition 
still records that proof and PrunePartitionPredicate later removes the filter. 
Because the new wrapper is created only in the < partitionNum branch, 
computeFilter applies the predicate's selectivity to the full-table estimate 
(for example an all-value dt IN (...) filter) even though execution keeps all 
rows. Carry the proof into the all-partitions statistics path, or avoid 
recording no-op proofs, so the estimate matches the post-processed plan.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java:
##########
@@ -1224,9 +1232,56 @@ public Statistics 
computeAssertNumRows(AssertNumRowsElement assertNumRowsElement
      * computeFilter
      */

Review Comment:
   [P1] Remap proven conjuncts before subtracting them from copied filters.
   
   PartitionPrunablePredicate survives MV/deep-copy rewrites, but those 
rewrites give the scan and filter slots fresh ExprIds. 
Sets.difference(filter.getConjuncts(), partitionStats.provenConjuncts) 
therefore does not match a semantically identical dt = ... conjunct, so a 
filter on a selected partition is estimated again (for example 1,000 rows 
becomes 250) even though PrunePartitionPredicate later removes it using its 
name-based snapshot-slot remap. Remap the proof conjuncts to the current 
scan/filter slots, or invalidate the proof when slots are rebuilt, before 
applying residual selectivity.



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

Reply via email to