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 dc30cc1d5eab38..aa53e478246613 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 @@ -3214,8 +3214,11 @@ public void initFuzzyModeVariables() { } 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 462ddbeb04d9d5..4fe8242eebbc3b 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"""