From 5f373965142e690c2537fced9f22f7d7f09119dc Mon Sep 17 00:00:00 2001 From: mch_ucchi <41606806+sohardforaname@users.noreply.github.com> Date: Mon, 29 May 2023 19:06:55 +0800 Subject: [PATCH] [Enhancement](Nerieds) add switch for developing Nereids DML (#20100) --- .../trees/plans/commands/InsertIntoTableCommand.java | 8 ++++++++ .../main/java/org/apache/doris/qe/SessionVariable.java | 9 +++++++++ .../nereids_p0/insert_into_table/unsupport_type.groovy | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/InsertIntoTableCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/InsertIntoTableCommand.java index df352fcc72..1781740de1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/InsertIntoTableCommand.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/InsertIntoTableCommand.java @@ -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 diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java index 042344f5b1..9df5b1101e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java @@ -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; } diff --git a/regression-test/suites/nereids_p0/insert_into_table/unsupport_type.groovy b/regression-test/suites/nereids_p0/insert_into_table/unsupport_type.groovy index 85925c6a37..821734d6da 100644 --- a/regression-test/suites/nereids_p0/insert_into_table/unsupport_type.groovy +++ b/regression-test/suites/nereids_p0/insert_into_table/unsupport_type.groovy @@ -23,7 +23,8 @@ suite("nereids_insert_array_type") { test { sql 'insert into arr_t select id, kaint from src' - exception 'type ARRAY is unsupported for Nereids' + // exception 'type ARRAY is unsupported for Nereids' + exception null } sql 'set enable_fallback_to_original_planner=true'