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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new fee5d40e07e [fix](planner) fix show variable display wrong 
enable_nereids_planner value (#50746)
fee5d40e07e is described below

commit fee5d40e07e105be1f1560443ca990ac73457d59
Author: 924060929 <[email protected]>
AuthorDate: Fri May 9 17:09:07 2025 +0800

    [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 <!-- At least one of them must be included. -->
        - [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 <!-- Add your reason?  -->
    
    - Behavior changed:
        - [x] 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 -->
---
 fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java | 4 +++-
 regression-test/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 ae8b3b84f6f..1d1a93e92e6 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 6de8075b630..f188fd794f5 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")
 }


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

Reply via email to