[Enhancement](Nerieds) add switch for developing Nereids DML (#20100)

This commit is contained in:
mch_ucchi
2023-05-29 19:06:55 +08:00
committed by GitHub
parent 5788214416
commit 5f37396514
3 changed files with 19 additions and 1 deletions

View File

@ -72,6 +72,14 @@ public class InsertIntoTableCommand extends Command implements ForwardWithSync {
@Override
public void run(ConnectContext ctx, StmtExecutor executor) throws Exception {
if (!ctx.getSessionVariable().isEnableNereidsDML()) {
try {
ctx.getSessionVariable().enableFallbackToOriginalPlannerOnce();
} catch (Exception e) {
throw new AnalysisException("failed to set fallback to original planner to true", e);
}
throw new AnalysisException("Nereids DML is disabled, will try to fall back to the original planner");
}
if (ctx.isTxnModel()) {
// in original planner, if is in txn model, insert into select command and tableRef >= 1 will be refused.
// we can just run select a one-row-relation like select 1, 2, 3

View File

@ -171,6 +171,8 @@ public class SessionVariable implements Serializable, Writable {
// turn off all automatic join reorder algorithms
public static final String DISABLE_JOIN_REORDER = "disable_join_reorder";
public static final String ENABLE_NEREIDS_DML = "enable_nereids_dml";
public static final String ENABLE_BUSHY_TREE = "enable_bushy_tree";
public static final String ENABLE_PARTITION_TOPN = "enable_partition_topn";
@ -572,6 +574,9 @@ public class SessionVariable implements Serializable, Writable {
@VariableMgr.VarAttr(name = EXTRACT_WIDE_RANGE_EXPR, needForward = true)
public boolean extractWideRangeExpr = true;
@VariableMgr.VarAttr(name = ENABLE_NEREIDS_DML)
public boolean enableNereidsDML = false;
@VariableMgr.VarAttr(name = ENABLE_VECTORIZED_ENGINE, expType = ExperimentalType.EXPERIMENTAL_ONLINE)
public boolean enableVectorizedEngine = true;
@ -1284,6 +1289,10 @@ public class SessionVariable implements Serializable, Writable {
return enableFoldConstantByBe;
}
public boolean isEnableNereidsDML() {
return enableNereidsDML;
}
public void setEnableFoldConstantByBe(boolean foldConstantByBe) {
this.enableFoldConstantByBe = foldConstantByBe;
}

View File

@ -23,7 +23,8 @@ suite("nereids_insert_array_type") {
test {
sql 'insert into arr_t select id, kaint from src'
exception 'type ARRAY<INT> is unsupported for Nereids'
// exception 'type ARRAY<INT> is unsupported for Nereids'
exception null
}
sql 'set enable_fallback_to_original_planner=true'