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 11d48b68d61 [fix](nereids) fix explain plan process throw
NullPointerException when use sql cache (#56336)
11d48b68d61 is described below
commit 11d48b68d61c366ea591d5e631c874c090bb2a24
Author: 924060929 <[email protected]>
AuthorDate: Fri Oct 10 15:23:53 2025 +0800
[fix](nereids) fix explain plan process throw NullPointerException when use
sql cache (#56336)
---
.../org/apache/doris/nereids/NereidsPlanner.java | 15 +++++++++++++++
.../cache/parse_sql_from_sql_cache.groovy | 21 +++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java
index c93fb3a9de0..75c2b3fe7f5 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/NereidsPlanner.java
@@ -227,6 +227,21 @@ public class NereidsPlanner extends Planner {
logicalSqlCache.getCacheValues(),
logicalSqlCache.getBackendAddress(),
logicalSqlCache.getPlanBody()
);
+ if (explainLevel != ExplainLevel.NONE) {
+ this.cascadesContext = CascadesContext.initContext(
+ statementContext, parsedPlan,
PhysicalProperties.ANY);
+ switch (explainLevel) {
+ case OPTIMIZED_PLAN:
+ case ALL_PLAN:
+ cascadesContext.addPlanProcess(
+ new PlanProcess("ImplementSqlCache",
+ parsedPlan.treeString(),
physicalPlan.treeString())
+ );
+ break;
+ default: {
+ }
+ }
+ }
return physicalPlan;
}
if (explainLevel == ExplainLevel.PARSED_PLAN || explainLevel ==
ExplainLevel.ALL_PLAN) {
diff --git
a/regression-test/suites/nereids_p0/cache/parse_sql_from_sql_cache.groovy
b/regression-test/suites/nereids_p0/cache/parse_sql_from_sql_cache.groovy
index f73b6004437..f017fa6d7f0 100644
--- a/regression-test/suites/nereids_p0/cache/parse_sql_from_sql_cache.groovy
+++ b/regression-test/suites/nereids_p0/cache/parse_sql_from_sql_cache.groovy
@@ -17,6 +17,7 @@
import com.google.common.util.concurrent.Uninterruptibles
+import org.apache.doris.regression.util.JdbcUtils
import java.util.concurrent.TimeUnit
import java.util.stream.Collectors
@@ -1150,6 +1151,26 @@ suite("parse_sql_from_sql_cache") {
sql "insert into test_use_plan_cache32 values (1, 1)"
assertNoCache "select * from
test_use_plan_cache32_view"
}
+ }),
+ extraThread("explain plan process", {
+ retryTestSqlCache(3, 1000) {
+ createTestTable "test_use_plan_cache33"
+
+ // after partition changed 10s, the sql cache can be
used
+ sleep(10000)
+
+ retryUntilHasSqlCache("select * from
test_use_plan_cache33")
+ test {
+ sql "explain logical plan process select * from
test_use_plan_cache33"
+ rowNum(0)
+ }
+ test {
+ sql "explain plan process select * from
test_use_plan_cache33"
+ check { rs, t, s, e ->
+
assertTrue(rs[0][1].toString().contains("LogicalSqlCache") &&
rs[0][2].toString().contains("PhysicalSqlCache"))
+ }
+ }
+ }
})
).get()
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]