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

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


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new c06d94fed52 branch-4.0: [fix](mtmv) Fix mv rewrite failed when mv is 
rewritten by LimitAggToTopNAgg but query is not #58974 (#59061)
c06d94fed52 is described below

commit c06d94fed521b8e35d5fb78bd05d2b9d5f30b5c0
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Dec 18 12:22:04 2025 +0800

    branch-4.0: [fix](mtmv) Fix mv rewrite failed when mv is rewritten by 
LimitAggToTopNAgg but query is not #58974 (#59061)
    
    Cherry-picked from #58974
    
    Co-authored-by: seawinde <[email protected]>
---
 fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java  | 7 +++++--
 .../mv/agg_optimize_when_uniform/agg_optimize_when_uniform.groovy  | 4 ++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
index 45ed90e5866..ec7a4f4a25b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@@ -3224,8 +3224,11 @@ public class SessionVariable implements Serializable, 
Writable {
         }
         this.runtimeFilterWaitInfinitely = random.nextBoolean();
 
-        // set random 1, 10, 100, 1000, 10000
-        this.topnOptLimitThreshold = (int) Math.pow(10, random.nextInt(5));
+        // set random 101, 100, 1000, 10000, should be greater than 100, 
because small limit may lead
+        // some test case failed, e.g. topN with limit 100 may not hit the 
LimitAggToTopNAgg rule
+        // optimization when fuzzy
+        int randomLimitThreshold = (int) Math.pow(10, random.nextInt(5));
+        this.topnOptLimitThreshold = randomLimitThreshold <= 100 ? 101 : 
randomLimitThreshold;
 
         // for spill to disk
         if (Config.fuzzy_test_type.equals("p0")) {
diff --git 
a/regression-test/suites/nereids_rules_p0/mv/agg_optimize_when_uniform/agg_optimize_when_uniform.groovy
 
b/regression-test/suites/nereids_rules_p0/mv/agg_optimize_when_uniform/agg_optimize_when_uniform.groovy
index 462ddbeb04d..4fe8242eebb 100644
--- 
a/regression-test/suites/nereids_rules_p0/mv/agg_optimize_when_uniform/agg_optimize_when_uniform.groovy
+++ 
b/regression-test/suites/nereids_rules_p0/mv/agg_optimize_when_uniform/agg_optimize_when_uniform.groovy
@@ -379,6 +379,10 @@ suite("agg_optimize_when_uniform") {
     def plan_6 = sql """explain verbose ${query6_0}"""
     logger.info("plan_6 is " + plan_6)
 
+    // This line of code is modified to position the occasional error: "null 
value is not in not null slot".
+    def query_mv6 = sql """select sum(__bin_4 is null) from mv6_0"""
+    logger.info("query_mv6 is " + query_mv6)
+
     order_qt_query6_0_after "${query6_0}"
     sql """ DROP MATERIALIZED VIEW IF EXISTS mv6_0"""
 


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

Reply via email to