[chore](Nereids) enable nereids if update from doris 1.x (#30369)

This commit is contained in:
morrySnow
2024-01-26 12:05:34 +08:00
committed by yiguolei
parent a954bab81a
commit 4bdc2cde2a
2 changed files with 24 additions and 0 deletions

View File

@ -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");
}
}

View File

@ -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);