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 ae8b3b84f6fb9c..1d1a93e92e60ed 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.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 void executeByLegacy(TUniqueId queryId) throws Exception { 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 6de8075b63092b..f188fd794f595d 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") }