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 43b104da10e branch-3.0 [fix](nereids) fix bug in 
StatsCalculator.disableJoinReorderIfStatsInvalid when rowCount is not aviable 
#53834 (#54427)
43b104da10e is described below

commit 43b104da10e34e166582498fc8822a364a5d7d1c
Author: minghong <[email protected]>
AuthorDate: Thu Aug 14 11:54:15 2025 +0800

    branch-3.0 [fix](nereids) fix bug in 
StatsCalculator.disableJoinReorderIfStatsInvalid when rowCount is not aviable 
#53834 (#54427)
    
    ### What problem does this PR solve?
    pick #53834
    Issue Number: close #xxx
    
    Related PR: #xxx
    
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 .../java/org/apache/doris/nereids/stats/StatsCalculator.java   | 10 ++++++++--
 .../suites/nereids_rules_p0/mv/ssb/mv_ssb_test.groovy          |  8 +++++++-
 2 files changed, 15 insertions(+), 3 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 a4f06cb9568..1314d81b1b8 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
@@ -258,8 +258,14 @@ public class StatsCalculator extends 
DefaultPlanVisitor<Statistics, Void> {
             double rowCount = calculator.getTableRowCount(scan);
             // row count not available
             if (rowCount == -1) {
-                LOG.info("disable join reorder since row count not available: "
-                        + scan.getTable().getNameWithFullQualifiers());
+                try {
+                    ConnectContext.get().getSessionVariable()
+                            .setVarOnce(SessionVariable.DISABLE_JOIN_REORDER, 
"true");
+                    LOG.info("disable join reorder since row count not 
available: "
+                            + scan.getTable().getNameWithFullQualifiers());
+                } catch (Exception e) {
+                    LOG.info("disableNereidsJoinReorderOnce failed");
+                }
                 return Optional.of("table[" + scan.getTable().getName() + "] 
row count is invalid");
             }
             if (scan instanceof OlapScan) {
diff --git a/regression-test/suites/nereids_rules_p0/mv/ssb/mv_ssb_test.groovy 
b/regression-test/suites/nereids_rules_p0/mv/ssb/mv_ssb_test.groovy
index a80690a7bbe..c0fe409c74f 100644
--- a/regression-test/suites/nereids_rules_p0/mv/ssb/mv_ssb_test.groovy
+++ b/regression-test/suites/nereids_rules_p0/mv/ssb/mv_ssb_test.groovy
@@ -89,7 +89,13 @@ suite("mv_ssb_test") {
     sql "set runtime_filter_mode=OFF"
     sql "SET enable_nereids_timeout = false"
     sql "SET BATCH_SIZE = 4064"
-
+    sql """
+          alter table customer modify column c_mktsegment SET STATS 
('ndv'='5', 'num_nulls'='0', 'row_count'='3000');
+          alter table lineorder modify column lo_revenue SET STATS 
('ndv'='453898', 'num_nulls'='0', 'row_count'='30600572');
+          alter table part modify column p_mfgr SET STATS ('ndv'='5', 
'num_nulls'='0', 'row_count'='20000.0');
+          alter table date modify column d_dayofweek  SET STATS ('ndv'='7', 
'num_nulls'='0', 'row_count'='255');
+          alter table supplier modify column s_phone  SET STATS ('ndv'='200', 
'num_nulls'='0', 'row_count'='200');
+        """
     def mv1_1 = """
             SELECT SUM(lo_extendedprice*lo_discount) AS
             REVENUE


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

Reply via email to