This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new a207a79729b [fix](nereids) bug: after is-null stats derive, other 
column stats are dropped #37809 (#37811)
a207a79729b is described below

commit a207a79729bce5d1498c290d7de7ff271c3434aa
Author: minghong <[email protected]>
AuthorDate: Mon Jul 15 16:24:29 2024 +0800

    [fix](nereids) bug: after is-null stats derive, other column stats are 
dropped #37809 (#37811)
    
    ## Proposed changes
    pick from #37809
    Issue Number: close #xxx
    
    <!--Describe your changes.-->
---
 .../main/java/org/apache/doris/nereids/stats/StatsCalculator.java  | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java
index f83521ae031..20db96ee1ec 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/StatsCalculator.java
@@ -829,17 +829,20 @@ public class StatsCalculator extends 
DefaultPlanVisitor<Statistics, Void> {
                 Statistics isNullStats = 
computeGeneratedIsNullStats((LogicalJoin) plan, filter);
                 if (isNullStats != null) {
                     // overwrite the stats corrected as above before passing 
to filter estimation
-                    stats = isNullStats;
                     Set<Expression> newConjuncts = 
filter.getConjuncts().stream()
                             .filter(e -> !(e instanceof IsNull))
                             .collect(Collectors.toSet());
                     if (newConjuncts.isEmpty()) {
-                        return stats;
+                        return isNullStats;
                     } else {
                         // overwrite the filter by removing is null and remain 
the others
                         filter = ((LogicalFilter<?>) 
filter).withConjunctsAndProps(newConjuncts,
                                 ((LogicalFilter<?>) 
filter).getGroupExpression(),
                                 Optional.of(((LogicalFilter<?>) 
filter).getLogicalProperties()), plan);
+                        // add update is-null related column stats for other 
predicate derive
+                        for (Expression expr : 
isNullStats.columnStatistics().keySet()) {
+                            stats.addColumnStats(expr, 
isNullStats.findColumnStatistics(expr));
+                        }
                     }
                 }
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to