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

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


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

commit 8e24d8f9dc903c3733734b6c94a4be73e74ab7ce
Author: minghong <engle...@gmail.com>
AuthorDate: Wed Jul 17 19:41:15 2024 +0800

    [fix](nereids) bug: after is-null stats derive, other column stats are 
dropped (#37809)
---
 .../java/org/apache/doris/nereids/stats/StatsCalculator.java  | 11 +++++++++--
 1 file changed, 9 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 5cc5ed90031..0a356f0a42f 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
@@ -832,17 +832,24 @@ 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
+                        StatisticsBuilder builder = new 
StatisticsBuilder(stats);
+                        for (Expression expr : 
isNullStats.columnStatistics().keySet()) {
+                            builder.putColumnStatistics(expr, 
isNullStats.findColumnStatistics(expr));
+                        }
+                        builder.setRowCount(isNullStats.getRowCount());
+                        stats = builder.build();
+                        stats.enforceValid();
                     }
                 }
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to