Skip to content

Commit

Permalink
[chore](Nereids) turn off fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
morrySnow committed Mar 28, 2024
1 parent 4665ee6 commit a668412
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ USING: 'USING';
VALUE: 'VALUE';
VALUES: 'VALUES';
VARCHAR: 'VARCHAR';
VARIANT: 'VARIANT';
VARIABLES: 'VARIABLES';
VERBOSE: 'VERBOSE';
VERSION: 'VERSION';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,7 @@ primitiveColType:
| type=DECIMALV3
| type=IPV4
| type=IPV6
| type=VARIANT
| type=ALL
;

Expand Down
5 changes: 4 additions & 1 deletion fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,10 @@ private void transferToMaster() {
"true");
}
if (journalVersion <= FeMetaVersion.VERSION_123) {
VariableMgr.refreshDefaultSessionVariables("2.0 to 2.1", SessionVariable.ENABLE_NEREIDS_DML, "true");
VariableMgr.refreshDefaultSessionVariables("2.0 to 2.1",
SessionVariable.ENABLE_NEREIDS_DML, "true");
VariableMgr.refreshDefaultSessionVariables("2.0 to 2.1",
SessionVariable.ENABLE_FALLBACK_TO_ORIGINAL_PLANNER, "false");
VariableMgr.refreshDefaultSessionVariables("2.0 to 2.1",
SessionVariable.FRAGMENT_TRANSMISSION_COMPRESSION_CODEC, "none");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public void checkColumn(ColumnDefinition column, KeysType keysType,
}
if (!(colType.isDateLikeType() || colType.isDecimalLikeType()
|| colType.isIntegralType() || colType.isStringLikeType()
|| colType.isBooleanType())) {
// TODO add colType.isVariantType() and colType.isAggState()
|| colType.isBooleanType() || colType.isVariantType())) {
// TODO add colType.isAggState()
throw new AnalysisException(colType + " is not supported in " + indexType.toString()
+ " index. " + "invalid index: " + name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ public static DataType convertPrimitiveFromStrings(List<String> types, boolean u
case "ipv6":
dataType = IPv6Type.INSTANCE;
break;
case "variant":
dataType = VariantType.INSTANCE;
break;
default:
throw new AnalysisException("Nereids do not support type: " + type);
}
Expand Down
18 changes: 18 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@

package org.apache.doris.qe;

import org.apache.doris.analysis.CreateTableAsSelectStmt;
import org.apache.doris.analysis.CreateTableStmt;
import org.apache.doris.analysis.DeleteStmt;
import org.apache.doris.analysis.InsertStmt;
import org.apache.doris.analysis.KillStmt;
import org.apache.doris.analysis.QueryStmt;
import org.apache.doris.analysis.SqlParser;
import org.apache.doris.analysis.SqlScanner;
import org.apache.doris.analysis.StatementBase;
import org.apache.doris.analysis.UpdateStmt;
import org.apache.doris.analysis.UserIdentity;
import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.DatabaseIf;
Expand Down Expand Up @@ -259,6 +263,20 @@ public void executeQuery(MysqlCommand mysqlCommand, String originStmt) throws Ex
}
}

if (mysqlCommand == MysqlCommand.COM_QUERY
&& ctx.getSessionVariable().isEnableNereidsPlanner()
&& !ctx.getSessionVariable().enableFallbackToOriginalPlanner
&& stmts.stream().allMatch(s -> s instanceof QueryStmt
|| s instanceof InsertStmt
|| s instanceof UpdateStmt
|| s instanceof DeleteStmt
|| s instanceof CreateTableAsSelectStmt
|| s instanceof CreateTableStmt)) {
handleQueryException(new AnalysisException("Nereids parse DQL failed. " + originStmt,
nereidsParseException), originStmt, null, null);
return;
}

List<String> origSingleStmtList = null;
// if stmts.size() > 1, split originStmt to multi singleStmts
if (stmts.size() > 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ public void setEnableLeftZigZag(boolean enableLeftZigZag) {
// for nereids, fallback will cause the Doris return the correct result although the syntax is unsupported
// in nereids for some mistaken modification. You should set it on the
@VariableMgr.VarAttr(name = ENABLE_FALLBACK_TO_ORIGINAL_PLANNER, needForward = true)
public boolean enableFallbackToOriginalPlanner = true;
public boolean enableFallbackToOriginalPlanner = false;

@VariableMgr.VarAttr(name = ENABLE_NEREIDS_TIMEOUT, needForward = true)
public boolean enableNereidsTimeout = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,11 +559,11 @@ public void execute(TUniqueId queryId) throws Exception {
boolean isInsertCommand = parsedStmt != null
&& parsedStmt instanceof LogicalPlanAdapter
&& ((LogicalPlanAdapter) parsedStmt).getLogicalPlan() instanceof InsertIntoTableCommand;
/*boolean isGroupCommit = (Config.wait_internal_group_commit_finish
|| context.sessionVariable.isEnableInsertGroupCommit()) && isInsertCommand;*/
boolean forceFallback = isInsertCommand && !context.isTxnModel();
boolean isGroupCommit = (Config.wait_internal_group_commit_finish
|| context.sessionVariable.isEnableInsertGroupCommit()) && isInsertCommand;
// boolean forceFallback = isInsertCommand && !context.isTxnModel();
if (e instanceof NereidsException && !context.getSessionVariable().enableFallbackToOriginalPlanner
&& !forceFallback) {
&& !isGroupCommit) {
LOG.warn("Analyze failed. {}", context.getQueryIdentifier(), e);
throw ((NereidsException) e).getException();
}
Expand Down

0 comments on commit a668412

Please sign in to comment.