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 192dc9cc2c1 [chore](Nereids) enable nereids if update from doris 1.x 
(#30369)
192dc9cc2c1 is described below

commit 192dc9cc2c1991f548c63982456341fe7781427c
Author: morrySnow <101034200+morrys...@users.noreply.github.com>
AuthorDate: Fri Jan 26 12:05:34 2024 +0800

    [chore](Nereids) enable nereids if update from doris 1.x (#30369)
---
 .../src/main/java/org/apache/doris/catalog/Env.java  |  4 ++++
 .../main/java/org/apache/doris/qe/VariableMgr.java   | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
index fbb4db00b6e..5c349bafde2 100755
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
@@ -1502,6 +1502,10 @@ public class Env {
                 VariableMgr.setGlobalBroadcastScaleFactor(newBcFactorVal);
                 LOG.info("upgrade FE from 1.x to 2.x, set 
broadcast_right_table_scale_factor "
                         + "to new default value: {}", newBcFactorVal);
+
+                // similar reason as above, need to upgrade 
enable_nereids_planner to true
+                VariableMgr.enableNereidsPlanner();
+                LOG.info("upgrade FE from 1.x to 2.x, set 
enable_nereids_planner to new default value: true");
             }
         }
 
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
index 7b797ea84a2..399170865cd 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
@@ -415,6 +415,26 @@ public class VariableMgr {
         }
     }
 
+    public static void enableNereidsPlanner() {
+        wlock.lock();
+        try {
+            VarContext ctx = 
ctxByVarName.get(SessionVariable.ENABLE_NEREIDS_PLANNER);
+            try {
+                setValue(ctx.getObj(), ctx.getField(), String.valueOf(true));
+            } catch (DdlException e) {
+                LOG.warn("failed to set global variable: {}", 
SessionVariable.ENABLE_NEREIDS_PLANNER, e);
+                return;
+            }
+
+            // write edit log
+            GlobalVarPersistInfo info = new 
GlobalVarPersistInfo(defaultSessionVariable,
+                    
Lists.newArrayList(SessionVariable.ENABLE_NEREIDS_PLANNER));
+            Env.getCurrentEnv().getEditLog().logGlobalVariableV2(info);
+        } finally {
+            wlock.unlock();
+        }
+    }
+
     public static void setLowerCaseTableNames(int mode) throws DdlException {
         VarContext ctx = 
ctxByVarName.get(GlobalVariable.LOWER_CASE_TABLE_NAMES);
         setGlobalVarAndWriteEditLog(ctx, 
GlobalVariable.LOWER_CASE_TABLE_NAMES, "" + mode);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to