From fee5d40e07e105be1f1560443ca990ac73457d59 Mon Sep 17 00:00:00 2001 From: 924060929 Date: Fri, 9 May 2025 17:09:07 +0800 Subject: [PATCH] [fix](planner) fix show variable display wrong enable_nereids_planner value (#50746) ### What problem does this PR solve? fix show variable display wrong enable_nereids_planner value, introduced by #49913 ### Release note None ### Check List (For Author) - Test - [x] 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 - Behavior changed: - [x] No. - [ ] Yes. - Does this need documentation? - [ ] No. - [ ] Yes. ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label --- .../src/main/java/org/apache/doris/qe/StmtExecutor.java | 4 +++- .../suites/show_p0/test_show_variables.groovy | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java index ae8b3b84f6..1d1a93e92e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java @@ -62,6 +62,7 @@ import org.apache.doris.analysis.SetType; import org.apache.doris.analysis.SetVar; import org.apache.doris.analysis.SetVar.SetVarType; import org.apache.doris.analysis.ShowStmt; +import org.apache.doris.analysis.ShowVariablesStmt; import org.apache.doris.analysis.SqlParser; import org.apache.doris.analysis.SqlScanner; import org.apache.doris.analysis.StatementBase; @@ -900,7 +901,8 @@ public class StmtExecutor { throw new TException("This is in a transaction, only insert, commit, rollback is acceptable."); } SessionVariable sessionVariable = context.getSessionVariable(); - if (!(parsedStmt instanceof SetStmt) && !(parsedStmt instanceof UnsetVariableStmt)) { + if (!(parsedStmt instanceof SetStmt) && !(parsedStmt instanceof UnsetVariableStmt) + && !(parsedStmt instanceof ShowVariablesStmt)) { sessionVariable.disableNereidsPlannerOnce(); } diff --git a/regression-test/suites/show_p0/test_show_variables.groovy b/regression-test/suites/show_p0/test_show_variables.groovy index 6de8075b63..f188fd794f 100644 --- a/regression-test/suites/show_p0/test_show_variables.groovy +++ b/regression-test/suites/show_p0/test_show_variables.groovy @@ -34,5 +34,12 @@ suite("test_show_variables", "p0") { result = sql """show variables like "enable_cooldown_replica_affinity%";""" assertTrue(result[0][1]=="false") result = sql """set GLOBAL enable_cooldown_replica_affinity=true;""" - + + sql "set enable_nereids_planner=true" + result = sql "show variables like '%enable_nereids_planner%'" + assertTrue(result[0][1]=="true") + + sql "set enable_nereids_planner=false" + result = sql "show variables like '%enable_nereids_planner%'" + assertTrue(result[0][1]=="false") }