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 7895835d8d4 [clean](planner) remove legacy planner code in 
StmtExecutor (#54496)
7895835d8d4 is described below

commit 7895835d8d4a6a7b9ba364ca3e8803efd5c15671
Author: morrySnow <[email protected]>
AuthorDate: Fri Aug 15 14:55:47 2025 +0800

    [clean](planner) remove legacy planner code in StmtExecutor (#54496)
---
 .../nereids/exceptions/MustFallbackException.java  |  27 --
 .../apache/doris/nereids/trees/plans/PlanType.java |   3 +-
 .../{UnsupportedCommand.java => EmptyCommand.java} |  20 +-
 .../plans/commands/ShowConstraintsCommand.java     |  25 +-
 .../plans/commands/ShowCreateMTMVCommand.java      |  14 +-
 .../plans/commands/info/ShowCreateMTMVInfo.java    |  22 +-
 .../trees/plans/visitor/CommandVisitor.java        |  10 +-
 .../main/java/org/apache/doris/qe/QueryState.java  |   2 +-
 .../java/org/apache/doris/qe/StmtExecutor.java     | 512 +--------------------
 .../java/org/apache/doris/qe/StmtExecutorTest.java |  39 +-
 10 files changed, 76 insertions(+), 598 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/MustFallbackException.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/MustFallbackException.java
deleted file mode 100644
index 83a4f17fc6f..00000000000
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/exceptions/MustFallbackException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.nereids.exceptions;
-
-/**
- * Exception for unsupported command to run in Nereids.
- */
-public class MustFallbackException extends RuntimeException {
-    public MustFallbackException(String msg) {
-        super(String.format("Must fallback to legacy planner, because %s", 
msg));
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/PlanType.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/PlanType.java
index b616f161a40..e150899f95c 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/PlanType.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/PlanType.java
@@ -443,5 +443,6 @@ public enum PlanType {
     SHOW_INDEX_ANALYZER_COMMAND,
     SHOW_INDEX_TOKENIZER_COMMAND,
     SHOW_INDEX_TOKEN_FILTER_COMMAND,
-    DROP_MATERIALIZED_VIEW_COMMAND
+    DROP_MATERIALIZED_VIEW_COMMAND,
+    EMPTY_COMMAND
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UnsupportedCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/EmptyCommand.java
similarity index 73%
rename from 
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UnsupportedCommand.java
rename to 
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/EmptyCommand.java
index 10025d88225..16723d57d95 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UnsupportedCommand.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/EmptyCommand.java
@@ -17,30 +17,32 @@
 
 package org.apache.doris.nereids.trees.plans.commands;
 
-import org.apache.doris.nereids.exceptions.MustFallbackException;
+import org.apache.doris.analysis.StmtType;
 import org.apache.doris.nereids.trees.plans.PlanType;
 import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor;
 import org.apache.doris.qe.ConnectContext;
 import org.apache.doris.qe.StmtExecutor;
 
 /**
- * all Nereids' unsupported command
+ * use to process empty statement: ""
  */
-public class UnsupportedCommand extends Command implements NoForward {
-
-    public static UnsupportedCommand INSTANCE = new UnsupportedCommand();
+public class EmptyCommand extends Command {
+    public EmptyCommand() {
+        super(PlanType.EMPTY_COMMAND);
+    }
 
-    public UnsupportedCommand() {
-        super(PlanType.UNSUPPORTED_COMMAND);
+    @Override
+    public StmtType stmtType() {
+        return StmtType.OTHER;
     }
 
     @Override
     public void run(ConnectContext ctx, StmtExecutor executor) throws 
Exception {
-        throw new MustFallbackException("unsupported command");
+       // do nothing
     }
 
     @Override
     public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {
-        return visitor.visitUnsupportedCommand(this, context);
+        return visitor.visitEmptyCommand(this, context);
     }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowConstraintsCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowConstraintsCommand.java
index 5c66e3a67dc..fbe3dfc5261 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowConstraintsCommand.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowConstraintsCommand.java
@@ -18,16 +18,18 @@
 package org.apache.doris.nereids.trees.plans.commands;
 
 import org.apache.doris.analysis.StmtType;
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.ScalarType;
 import org.apache.doris.catalog.TableIf;
 import org.apache.doris.nereids.trees.plans.PlanType;
 import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor;
 import org.apache.doris.nereids.util.RelationUtil;
 import org.apache.doris.qe.ConnectContext;
+import org.apache.doris.qe.ShowResultSet;
+import org.apache.doris.qe.ShowResultSetMetaData;
 import org.apache.doris.qe.StmtExecutor;
 
 import org.apache.hadoop.util.Lists;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 
 import java.util.List;
 import java.util.Optional;
@@ -36,9 +38,14 @@ import java.util.stream.Collectors;
 /**
  * add constraint command
  */
-public class ShowConstraintsCommand extends Command implements NoForward {
+public class ShowConstraintsCommand extends ShowCommand {
+
+    private static final ShowResultSetMetaData META_DATA = 
ShowResultSetMetaData.builder()
+            .addColumn(new Column("Name", ScalarType.createVarchar(20)))
+            .addColumn(new Column("Type", ScalarType.createVarchar(20)))
+            .addColumn(new Column("Definition", ScalarType.createVarchar(20)))
+            .build();
 
-    public static final Logger LOG = 
LogManager.getLogger(ShowConstraintsCommand.class);
     private final List<String> nameParts;
 
     /**
@@ -50,7 +57,12 @@ public class ShowConstraintsCommand extends Command 
implements NoForward {
     }
 
     @Override
-    public void run(ConnectContext ctx, StmtExecutor executor) throws 
Exception {
+    public ShowResultSetMetaData getMetaData() {
+        return META_DATA;
+    }
+
+    @Override
+    public ShowResultSet doRun(ConnectContext ctx, StmtExecutor executor) 
throws Exception {
         TableIf tableIf = RelationUtil.getDbAndTable(
                 RelationUtil.getQualifierName(ctx, nameParts), ctx.getEnv(), 
Optional.empty()).value();
         tableIf.readLock();
@@ -64,8 +76,7 @@ public class ShowConstraintsCommand extends Command 
implements NoForward {
         } finally {
             tableIf.readUnlock();
         }
-        executor.handleShowConstraintStmt(res);
-
+        return new ShowResultSet(META_DATA, res);
     }
 
     @Override
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowCreateMTMVCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowCreateMTMVCommand.java
index 19ecac345b3..d0af6f66318 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowCreateMTMVCommand.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowCreateMTMVCommand.java
@@ -22,6 +22,8 @@ import org.apache.doris.nereids.trees.plans.PlanType;
 import org.apache.doris.nereids.trees.plans.commands.info.ShowCreateMTMVInfo;
 import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor;
 import org.apache.doris.qe.ConnectContext;
+import org.apache.doris.qe.ShowResultSet;
+import org.apache.doris.qe.ShowResultSetMetaData;
 import org.apache.doris.qe.StmtExecutor;
 
 import java.util.Objects;
@@ -29,7 +31,8 @@ import java.util.Objects;
 /**
  * resume mtmv
  */
-public class ShowCreateMTMVCommand extends Command implements NoForward {
+public class ShowCreateMTMVCommand extends ShowCommand {
+
     private final ShowCreateMTMVInfo showCreateMTMVInfo;
 
     public ShowCreateMTMVCommand(ShowCreateMTMVInfo showCreateMTMVInfo) {
@@ -38,9 +41,14 @@ public class ShowCreateMTMVCommand extends Command 
implements NoForward {
     }
 
     @Override
-    public void run(ConnectContext ctx, StmtExecutor executor) throws 
Exception {
+    public ShowResultSetMetaData getMetaData() {
+        return showCreateMTMVInfo.getMetaData();
+    }
+
+    @Override
+    public ShowResultSet doRun(ConnectContext ctx, StmtExecutor executor) 
throws Exception {
         showCreateMTMVInfo.analyze(ctx);
-        showCreateMTMVInfo.run(executor);
+        return showCreateMTMVInfo.getShowResultSet();
     }
 
     @Override
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/ShowCreateMTMVInfo.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/ShowCreateMTMVInfo.java
index b4fde11c3e1..5b50ccd449d 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/ShowCreateMTMVInfo.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/ShowCreateMTMVInfo.java
@@ -17,9 +17,11 @@
 
 package org.apache.doris.nereids.trees.plans.commands.info;
 
+import org.apache.doris.catalog.Column;
 import org.apache.doris.catalog.Database;
 import org.apache.doris.catalog.Env;
 import org.apache.doris.catalog.MTMV;
+import org.apache.doris.catalog.ScalarType;
 import org.apache.doris.catalog.TableIf.TableType;
 import org.apache.doris.common.DdlException;
 import org.apache.doris.common.ErrorCode;
@@ -27,7 +29,8 @@ import org.apache.doris.common.MetaNotFoundException;
 import org.apache.doris.mysql.privilege.PrivPredicate;
 import org.apache.doris.nereids.exceptions.AnalysisException;
 import org.apache.doris.qe.ConnectContext;
-import org.apache.doris.qe.StmtExecutor;
+import org.apache.doris.qe.ShowResultSet;
+import org.apache.doris.qe.ShowResultSetMetaData;
 
 import com.google.common.collect.Lists;
 
@@ -39,6 +42,12 @@ import java.util.Objects;
  * show create mtmv info
  */
 public class ShowCreateMTMVInfo {
+
+    private static final ShowResultSetMetaData META_DATA = 
ShowResultSetMetaData.builder()
+            .addColumn(new Column("Materialized View", 
ScalarType.createVarchar(20)))
+            .addColumn(new Column("Create Materialized View", 
ScalarType.createVarchar(30)))
+            .build();
+
     private final TableNameInfo mvName;
 
     public ShowCreateMTMVInfo(TableNameInfo mvName) {
@@ -70,17 +79,22 @@ public class ShowCreateMTMVInfo {
     /**
      * run show create materialized view
      *
-     * @param executor executor
      * @throws DdlException DdlException
      * @throws IOException IOException
      */
-    public void run(StmtExecutor executor) throws DdlException, IOException, 
org.apache.doris.common.AnalysisException {
+    public ShowResultSet getShowResultSet() throws DdlException, IOException,
+            org.apache.doris.common.AnalysisException {
         List<List<String>> rows = Lists.newArrayList();
         Database db = 
Env.getCurrentInternalCatalog().getDbOrDdlException(mvName.getDb());
         MTMV mtmv = (MTMV) db.getTableOrDdlException(mvName.getTbl());
         String mtmvDdl = Env.getMTMVDdl(mtmv);
         rows.add(Lists.newArrayList(mtmv.getName(), mtmvDdl));
-        executor.handleShowCreateMTMVStmt(rows);
+        return new ShowResultSet(META_DATA, rows);
+
+    }
+
+    public ShowResultSetMetaData getMetaData() {
+        return META_DATA;
     }
 
     /**
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/visitor/CommandVisitor.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/visitor/CommandVisitor.java
index 5936c2e9fd1..a5f9a00be1d 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/visitor/CommandVisitor.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/visitor/CommandVisitor.java
@@ -125,6 +125,7 @@ import 
org.apache.doris.nereids.trees.plans.commands.DropUserCommand;
 import org.apache.doris.nereids.trees.plans.commands.DropViewCommand;
 import org.apache.doris.nereids.trees.plans.commands.DropWorkloadGroupCommand;
 import org.apache.doris.nereids.trees.plans.commands.DropWorkloadPolicyCommand;
+import org.apache.doris.nereids.trees.plans.commands.EmptyCommand;
 import org.apache.doris.nereids.trees.plans.commands.ExplainCommand;
 import org.apache.doris.nereids.trees.plans.commands.ExplainDictionaryCommand;
 import org.apache.doris.nereids.trees.plans.commands.ExportCommand;
@@ -270,7 +271,6 @@ import 
org.apache.doris.nereids.trees.plans.commands.UninstallPluginCommand;
 import org.apache.doris.nereids.trees.plans.commands.UnlockTablesCommand;
 import 
org.apache.doris.nereids.trees.plans.commands.UnsetDefaultStorageVaultCommand;
 import org.apache.doris.nereids.trees.plans.commands.UnsetVariableCommand;
-import org.apache.doris.nereids.trees.plans.commands.UnsupportedCommand;
 import org.apache.doris.nereids.trees.plans.commands.UpdateCommand;
 import org.apache.doris.nereids.trees.plans.commands.WarmUpClusterCommand;
 import 
org.apache.doris.nereids.trees.plans.commands.alter.AlterDatabaseRenameCommand;
@@ -551,10 +551,6 @@ public interface CommandVisitor<R, C> {
         return visitCommand(showStagesCommand, context);
     }
 
-    default R visitUnsupportedCommand(UnsupportedCommand unsupportedCommand, C 
context) {
-        return visitCommand(unsupportedCommand, context);
-    }
-
     default R visitUnsupportedStartTransactionCommand(StartTransactionCommand 
unsupportedStartTransactionCommand,
                                                       C context) {
         return visitCommand(unsupportedStartTransactionCommand, context);
@@ -1426,4 +1422,8 @@ public interface CommandVisitor<R, C> {
     default R visitDropMaterializedViewCommand(DropMaterializedViewCommand 
dropMaterializedViewCommand, C context) {
         return visitCommand(dropMaterializedViewCommand, context);
     }
+
+    default R visitEmptyCommand(EmptyCommand emptyCommand, C context) {
+        return visitCommand(emptyCommand, context);
+    }
 }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/QueryState.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/QueryState.java
index f3b9cacb026..89c44babad9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/QueryState.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/QueryState.java
@@ -49,7 +49,7 @@ public class QueryState {
     private int warningRows = 0;
     // make it public for easy to use
     public int serverStatus = 0;
-    private boolean isNereids = false;
+    private boolean isNereids = true;
     private boolean isInternal = false;
     private ShowResultSet rs = null;
 
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
index 4e3fde9a93e..f87e9e594eb 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
@@ -17,34 +17,20 @@
 
 package org.apache.doris.qe;
 
-import org.apache.doris.analysis.CreateRoutineLoadStmt;
-import org.apache.doris.analysis.DdlStmt;
-import org.apache.doris.analysis.ExportStmt;
 import org.apache.doris.analysis.Expr;
-import org.apache.doris.analysis.LoadStmt;
-import org.apache.doris.analysis.LockTablesStmt;
 import org.apache.doris.analysis.OutFileClause;
 import org.apache.doris.analysis.PlaceHolderExpr;
 import org.apache.doris.analysis.Queriable;
 import org.apache.doris.analysis.RedirectStatus;
-import org.apache.doris.analysis.ResourceTypeEnum;
 import org.apache.doris.analysis.SetStmt;
 import org.apache.doris.analysis.SetType;
 import org.apache.doris.analysis.SetVar;
 import org.apache.doris.analysis.SetVar.SetVarType;
-import org.apache.doris.analysis.ShowStmt;
-import org.apache.doris.analysis.SqlParser;
-import org.apache.doris.analysis.SqlScanner;
 import org.apache.doris.analysis.StatementBase;
 import org.apache.doris.analysis.StorageBackend;
 import org.apache.doris.analysis.StorageBackend.StorageType;
 import org.apache.doris.analysis.StringLiteral;
-import org.apache.doris.analysis.SwitchStmt;
-import org.apache.doris.analysis.UnifiedLoadStmt;
-import org.apache.doris.analysis.UnlockTablesStmt;
 import org.apache.doris.analysis.UnsetVariableStmt;
-import org.apache.doris.analysis.UnsupportedStmt;
-import org.apache.doris.analysis.UseStmt;
 import org.apache.doris.catalog.Column;
 import org.apache.doris.catalog.DatabaseIf;
 import org.apache.doris.catalog.Env;
@@ -54,10 +40,8 @@ import org.apache.doris.catalog.PrimitiveType;
 import org.apache.doris.catalog.ScalarType;
 import org.apache.doris.catalog.TableIf;
 import org.apache.doris.catalog.Type;
-import org.apache.doris.cloud.analysis.UseCloudClusterStmt;
 import org.apache.doris.cloud.catalog.CloudEnv;
 import org.apache.doris.cloud.proto.Cloud.ClusterStatus;
-import org.apache.doris.cloud.qe.ComputeGroupException;
 import org.apache.doris.cloud.system.CloudSystemInfoService;
 import org.apache.doris.common.AnalysisException;
 import org.apache.doris.common.AuditLog;
@@ -84,11 +68,7 @@ import org.apache.doris.common.util.NetUtils;
 import org.apache.doris.common.util.TimeUtils;
 import org.apache.doris.common.util.Util;
 import org.apache.doris.datasource.FileScanNode;
-import org.apache.doris.datasource.jdbc.client.JdbcClientException;
 import org.apache.doris.datasource.tvf.source.TVFScanNode;
-import org.apache.doris.load.EtlJobType;
-import org.apache.doris.load.LoadJobRowResult;
-import org.apache.doris.load.loadv2.LoadManager;
 import org.apache.doris.mysql.FieldInfo;
 import org.apache.doris.mysql.MysqlChannel;
 import org.apache.doris.mysql.MysqlCommand;
@@ -96,13 +76,11 @@ import org.apache.doris.mysql.MysqlEofPacket;
 import org.apache.doris.mysql.MysqlOkPacket;
 import org.apache.doris.mysql.MysqlSerializer;
 import org.apache.doris.mysql.ProxyMysqlChannel;
-import org.apache.doris.mysql.privilege.PrivPredicate;
 import org.apache.doris.nereids.NereidsPlanner;
 import org.apache.doris.nereids.PlanProcess;
 import org.apache.doris.nereids.StatementContext;
 import org.apache.doris.nereids.analyzer.UnboundBaseExternalTableSink;
 import org.apache.doris.nereids.analyzer.UnboundTableSink;
-import org.apache.doris.nereids.exceptions.MustFallbackException;
 import org.apache.doris.nereids.exceptions.ParseException;
 import org.apache.doris.nereids.glue.LogicalPlanAdapter;
 import org.apache.doris.nereids.minidump.MinidumpUtils;
@@ -114,16 +92,15 @@ import 
org.apache.doris.nereids.trees.expressions.literal.DateTimeV2Literal;
 import org.apache.doris.nereids.trees.plans.Plan;
 import org.apache.doris.nereids.trees.plans.algebra.InlineTable;
 import org.apache.doris.nereids.trees.plans.commands.Command;
-import org.apache.doris.nereids.trees.plans.commands.CreatePolicyCommand;
 import org.apache.doris.nereids.trees.plans.commands.CreateTableCommand;
 import org.apache.doris.nereids.trees.plans.commands.DeleteFromCommand;
 import org.apache.doris.nereids.trees.plans.commands.DeleteFromUsingCommand;
+import org.apache.doris.nereids.trees.plans.commands.EmptyCommand;
 import org.apache.doris.nereids.trees.plans.commands.Forward;
 import org.apache.doris.nereids.trees.plans.commands.LoadCommand;
 import org.apache.doris.nereids.trees.plans.commands.PrepareCommand;
 import org.apache.doris.nereids.trees.plans.commands.Redirect;
 import org.apache.doris.nereids.trees.plans.commands.TransactionCommand;
-import org.apache.doris.nereids.trees.plans.commands.UnsupportedCommand;
 import org.apache.doris.nereids.trees.plans.commands.UpdateCommand;
 import 
org.apache.doris.nereids.trees.plans.commands.insert.BatchInsertIntoTableCommand;
 import 
org.apache.doris.nereids.trees.plans.commands.insert.InsertIntoTableCommand;
@@ -156,7 +133,6 @@ import org.apache.doris.system.Backend;
 import org.apache.doris.system.SystemInfoService;
 import org.apache.doris.thrift.BackendService.Client;
 import org.apache.doris.thrift.TNetworkAddress;
-import org.apache.doris.thrift.TQueryOptions;
 import org.apache.doris.thrift.TResultBatch;
 import org.apache.doris.thrift.TResultFileSink;
 import org.apache.doris.thrift.TResultFileSinkOptions;
@@ -175,11 +151,9 @@ import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
-import org.apache.thrift.TException;
 import org.apache.thrift.TSerializer;
 
 import java.io.IOException;
-import java.io.StringReader;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -548,38 +522,13 @@ public class StmtExecutor {
         try {
             try {
                 executeByNereids(queryId);
-            } catch (NereidsException | ParseException e) {
+            } catch (Exception e) {
                 if (context.getMinidump() != null && 
context.getMinidump().toString(4) != null) {
                     MinidumpUtils.saveMinidumpString(context.getMinidump(), 
DebugUtil.printId(context.queryId()));
                 }
-                // try to fall back to legacy planner
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("nereids cannot process statement\n{}\n because 
of {}",
-                            originStmt.originStmt, e.getMessage(), e);
-                }
-                // only must fall back + unsupported command could use legacy 
planner
-                if ((e instanceof NereidsException
-                        && !(((NereidsException) e).getException() instanceof 
MustFallbackException))
-                        || !((parsedStmt instanceof LogicalPlanAdapter
-                        && ((LogicalPlanAdapter) parsedStmt).getLogicalPlan() 
instanceof Command))) {
-                    LOG.warn("Analyze failed. {}", 
context.getQueryIdentifier(), e);
-                    context.getState().setError(e.getMessage());
-                    return;
-                }
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("fall back to legacy planner on statement:\n{}", 
originStmt.originStmt);
-                }
-                parsedStmt = null;
-                planner = null;
-                isForwardedToMaster = null;
-                redirectStatus = null;
-                // Attention: currently exception from nereids does not mean 
an Exception to user terminal
-                // unless user does not allow fallback to lagency planner. But 
state of query
-                // has already been set to Error in this case, it will have 
some side effect on profile result
-                // and audit log. So we need to reset state to OK if query 
cancel be processd by lagency.
-                context.getState().reset();
-                context.getState().setNereids(false);
-                executeByLegacy(queryId);
+                LOG.warn("Analyze failed. {}", context.getQueryIdentifier(), 
e);
+                context.getState().setError(e.getMessage());
+                return;
             }
         } finally {
             // revert Session Value
@@ -649,10 +598,6 @@ public class StmtExecutor {
             if (isForwardToMaster()) {
                 throw new UserException("Forward master command is not 
supported for prepare statement");
             }
-            if (logicalPlan instanceof UnsupportedCommand || logicalPlan 
instanceof CreatePolicyCommand) {
-                throw new NereidsException(
-                        new MustFallbackException("cannot prepare command " + 
logicalPlan.getClass().getSimpleName()));
-            }
             long stmtId = Config.prepared_stmt_start_id > 0
                     ? Config.prepared_stmt_start_id : 
context.getPreparedStmtId();
             this.prepareStmtName = String.valueOf(stmtId);
@@ -666,8 +611,7 @@ public class StmtExecutor {
         if (context.isTxnModel()) {
             if (!(logicalPlan instanceof BatchInsertIntoTableCommand || 
logicalPlan instanceof InsertIntoTableCommand
                     || logicalPlan instanceof UpdateCommand || logicalPlan 
instanceof DeleteFromUsingCommand
-                    || logicalPlan instanceof DeleteFromCommand || logicalPlan 
instanceof TransactionCommand
-                    || logicalPlan instanceof UnsupportedCommand)) {
+                    || logicalPlan instanceof DeleteFromCommand || logicalPlan 
instanceof TransactionCommand)) {
                 String errMsg = "This is in a transaction, only insert, 
update, delete, "
                         + "commit, rollback is acceptable.";
                 throw new NereidsException(errMsg, new 
AnalysisException(errMsg));
@@ -710,11 +654,6 @@ public class StmtExecutor {
             try {
                 ((Command) logicalPlan).verifyCommandSupported(context);
                 ((Command) logicalPlan).run(context, this);
-            } catch (MustFallbackException e) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Command({}) process failed.", 
originStmt.originStmt, e);
-                }
-                throw new NereidsException("Command(" + originStmt.originStmt 
+ ") process failed.", e);
             } catch (QueryStateException e) {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("Command({}) process failed.", 
originStmt.originStmt, e);
@@ -777,9 +716,6 @@ public class StmtExecutor {
             try {
                 planner.plan(parsedStmt, 
context.getSessionVariable().toThrift());
                 checkBlockRules();
-            } catch (MustFallbackException e) {
-                LOG.warn("Nereids plan query failed:\n{}", 
originStmt.originStmt, e);
-                throw new NereidsException("Command(" + originStmt.originStmt 
+ ") process failed.", e);
             } catch (Exception e) {
                 LOG.warn("Nereids plan query failed:\n{}", 
originStmt.originStmt, e);
                 throw new NereidsException(new 
AnalysisException(e.getMessage(), e));
@@ -820,7 +756,7 @@ public class StmtExecutor {
         }
         if (statements.isEmpty()) {
             // for test only
-            parsedStmt = new LogicalPlanAdapter(new UnsupportedCommand(), new 
StatementContext());
+            parsedStmt = new LogicalPlanAdapter(new EmptyCommand(), new 
StatementContext());
         } else {
             if (statements.size() <= originStmt.idx) {
                 throw new ParseException("Nereids parse failed. Parser get " + 
statements.size() + " statements,"
@@ -875,6 +811,7 @@ public class StmtExecutor {
                     context.setReturnResultFromLocal(false);
                 }
                 handleQueryStmt();
+                LOG.info("Query {} finished", 
DebugUtil.printId(context.queryId));
                 break;
             } catch (RpcException | UserException e) {
                 if (Config.isCloudMode() && 
e.getMessage().contains(FeConstants.CLOUD_RETRY_E230)) {
@@ -938,122 +875,6 @@ public class StmtExecutor {
         }
     }
 
-    // Execute one statement with queryId
-    // The queryId will be set in ConnectContext
-    // This queryId will also be sent to master FE for exec master only query.
-    // query id in ConnectContext will be changed when retry exec a query or 
master FE return a different one.
-    // Exception:
-    // IOException: talk with client failed.
-    public void executeByLegacy(TUniqueId queryId) throws Exception {
-        context.setStartTime();
-
-        
profile.getSummaryProfile().setQueryBeginTime(TimeUtils.getStartTimeMs());
-        context.setStmtId(STMT_ID_GENERATOR.incrementAndGet());
-        context.setQueryId(queryId);
-
-        try {
-            // parsedStmt maybe null here, we parse it. Or the predicate will 
not work.
-            parseByLegacy();
-            checkSqlBlocked(parsedStmt.getClass());
-            if (context.isTxnModel()) {
-                throw new TException("This is in a transaction, only insert, 
update, delete, "
-                        + "commit, rollback is acceptable.");
-            }
-
-            if (!context.isTxnModel()) {
-                // analyze this query
-                analyze(context.getSessionVariable().toThrift());
-
-                if (isForwardToMaster()) {
-                    if (context.getCommand() == MysqlCommand.COM_STMT_PREPARE
-                                || context.getCommand() == 
MysqlCommand.COM_STMT_EXECUTE) {
-                        throw new UserException("Forward master command is not 
supported for prepare statement");
-                    }
-                    if (isProxy) {
-                        // This is already a stmt forwarded from other FE.
-                        // If goes here, which means we can't find a valid 
Master FE(some error happens).
-                        // To avoid endless forward, throw exception here.
-                        throw new UserException("The statement has been 
forwarded to master FE("
-                                + Env.getCurrentEnv().getSelfNode().getHost() 
+ ") and failed to execute"
-                                + " because Master FE is not ready. You may 
need to check FE's status");
-                    }
-                    forwardToMaster();
-                    if (masterOpExecutor != null && 
masterOpExecutor.getQueryId() != null) {
-                        context.setQueryId(masterOpExecutor.getQueryId());
-                    }
-                    return;
-                } else {
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("no need to transfer to Master. stmt: {}", 
context.getStmtId());
-                    }
-                }
-            } else {
-                // Query following createting table would throw table not 
exist error.
-                // For example.
-                // t1: client issues create table to master fe
-                // t2: client issues query sql to observer fe, the query would 
fail due to not exist table
-                //     in plan phase.
-                // t3: observer fe receive editlog creating the table from the 
master fe
-                syncJournalIfNeeded();
-                parsedStmt.analyze();
-            }
-            parsedStmt.checkPriv();
-            // sql/sqlHash block
-            checkBlockRules();
-            if (parsedStmt instanceof SetStmt) {
-                handleSetStmt();
-            } else if (parsedStmt instanceof UnsetVariableStmt) {
-                handleUnsetVariableStmt();
-            } else if (parsedStmt instanceof SwitchStmt) {
-                handleSwitchStmt();
-            } else if (parsedStmt instanceof UseStmt) {
-                handleUseStmt();
-            }  else if (parsedStmt instanceof UseCloudClusterStmt) {
-                // jdbc client use
-                handleUseCloudClusterStmt();
-            } else if (parsedStmt instanceof LoadStmt) {
-                handleLoadStmt();
-            } else if (parsedStmt instanceof DdlStmt) {
-                handleDdlStmt();
-            } else if (parsedStmt instanceof ShowStmt) {
-                handleShow();
-            } else if (parsedStmt instanceof ExportStmt) {
-                handleExportStmt();
-            } else if (parsedStmt instanceof UnlockTablesStmt) {
-                handleUnlockTablesStmt();
-            } else if (parsedStmt instanceof LockTablesStmt) {
-                handleLockTablesStmt();
-            } else if (parsedStmt instanceof UnsupportedStmt) {
-                handleUnsupportedStmt();
-            } else {
-                context.getState().setError(ErrorCode.ERR_NOT_SUPPORTED_YET, 
"Do not support this query.");
-            }
-        } catch (IOException e) {
-            LOG.warn("execute IOException. {}", context.getQueryIdentifier(), 
e);
-            // the exception happens when interact with client
-            // this exception shows the connection is gone
-            context.getState().setError(ErrorCode.ERR_UNKNOWN_ERROR, 
e.getMessage());
-            throw e;
-        } catch (UserException e) {
-            // insert into select
-            if (Config.isCloudMode() && 
e.getMessage().contains(FeConstants.CLOUD_RETRY_E230)) {
-                throw e;
-            }
-            // analysis exception only print message, not print the stack
-            LOG.warn("execute Exception. {}", context.getQueryIdentifier(), e);
-            context.getState().setError(e.getMysqlErrorCode(), e.getMessage());
-            context.getState().setErrType(QueryState.ErrType.ANALYSIS_ERR);
-        } catch (JdbcClientException e) {
-            LOG.warn("execute Exception. {}", context.getQueryIdentifier(), e);
-            context.getState().setError(ErrorCode.ERR_UNKNOWN_ERROR,
-                    e.getMessage());
-        } catch (Exception e) {
-            LOG.warn("execute Exception. {}", context.getQueryIdentifier(), e);
-            context.getState().setError(ErrorCode.ERR_UNKNOWN_ERROR,
-                    e.getClass().getSimpleName() + ", msg: " + 
Util.getRootCauseWithSuppressedMessage(e));
-        }
-    }
-
     private void syncJournalIfNeeded() throws Exception {
         final Env env = context.getEnv();
         if (env.isMaster() || 
!context.getSessionVariable().enableStrongConsistencyRead) {
@@ -1167,103 +988,6 @@ public class StmtExecutor {
         }
     }
 
-    private boolean hasCloudClusterPriv() {
-        String clusterName = "";
-        try {
-            clusterName = ConnectContext.get().getCloudCluster();
-        } catch (ComputeGroupException e) {
-            LOG.warn("failed to get cloud cluster", e);
-            return false;
-        }
-        if (ConnectContext.get() == null || 
Strings.isNullOrEmpty(clusterName)) {
-            return false;
-        }
-        return 
Env.getCurrentEnv().getAccessManager().checkCloudPriv(ConnectContext.get().getCurrentUserIdentity(),
-            clusterName, PrivPredicate.USAGE, ResourceTypeEnum.CLUSTER);
-    }
-
-    // Analyze one statement to structure in memory.
-    public void analyze(TQueryOptions tQueryOptions) throws UserException, 
InterruptedException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("begin to analyze stmt: {}, forwarded stmt id: {}", 
context.getStmtId(),
-                    context.getForwardedStmtId());
-        }
-
-        parseByLegacy();
-
-        // yiguolei: insert stmt's grammar analysis will write editlog,
-        // so that we check if the stmt should be forward to master here
-        // if the stmt should be forward to master, then just return here and 
the master will do analysis again
-        if (isForwardToMaster()) {
-            return;
-        }
-
-        // convert unified load stmt here
-        if (parsedStmt instanceof UnifiedLoadStmt) {
-            // glue code for unified load
-            final UnifiedLoadStmt unifiedLoadStmt = (UnifiedLoadStmt) 
parsedStmt;
-            unifiedLoadStmt.init();
-            final StatementBase proxyStmt = unifiedLoadStmt.getProxyStmt();
-            parsedStmt = proxyStmt;
-            if (!(proxyStmt instanceof LoadStmt) && !(proxyStmt instanceof 
CreateRoutineLoadStmt)) {
-                Preconditions.checkState(
-                        true,
-                        "enable_unified_load=true, should be insert stmt");
-            }
-        }
-
-        try {
-            parsedStmt.analyze();
-        } catch (UserException e) {
-            throw e;
-        } catch (Exception e) {
-            LOG.warn("Analyze failed. {}", context.getQueryIdentifier(), e);
-            throw new AnalysisException("Unexpected exception: " + 
e.getMessage());
-        }
-
-    }
-
-    private void parseByLegacy() throws AnalysisException, DdlException {
-        // parsedStmt may already by set when constructing this StmtExecutor();
-        if (parsedStmt == null) {
-            // Parse statement with parser generated by CUP&FLEX
-            SqlScanner input = new SqlScanner(new 
StringReader(originStmt.originStmt),
-                    context.getSessionVariable().getSqlMode());
-            SqlParser parser = new SqlParser(input);
-            try {
-                List<StatementBase> stmts = (List<StatementBase>) 
parser.parse().value;
-                if (originStmt.idx >= stmts.size()) {
-                    throw new AnalysisException("Invalid statement index: "
-                            + originStmt.idx + ". size: " + stmts.size());
-                }
-                parsedStmt = stmts.get(originStmt.idx);
-                parsedStmt.setOrigStmt(originStmt);
-                parsedStmt.setUserInfo(context.getCurrentUserIdentity());
-            } catch (Error e) {
-                LOG.info("error happened when parsing stmt {}, id: {}", 
originStmt, context.getStmtId(), e);
-                throw new AnalysisException("sql parsing error, please check 
your sql");
-            } catch (AnalysisException e) {
-                String syntaxError = parser.getErrorMsg(originStmt.originStmt);
-                LOG.info("analysis exception happened when parsing stmt {}, 
id: {}, error: {}",
-                        originStmt, context.getStmtId(), syntaxError, e);
-                if (syntaxError == null) {
-                    throw e;
-                } else {
-                    throw new AnalysisException(syntaxError, e);
-                }
-            } catch (Exception e) {
-                // TODO(lingbin): we catch 'Exception' to prevent unexpected 
error,
-                // should be removed this try-catch clause future.
-                LOG.info("unexpected exception happened when parsing stmt {}, 
id: {}, error: {}",
-                        originStmt, context.getStmtId(), 
parser.getErrorMsg(originStmt.originStmt), e);
-                throw new AnalysisException("Unexpected exception: " + 
e.getMessage());
-            }
-
-            analyzeVariablesInStmt();
-        }
-        redirectStatus = parsedStmt.getRedirectStatus();
-    }
-
     // Because this is called by other thread
     public void cancel(Status cancelReason, boolean needWaitCancelComplete) {
         if (masterOpExecutor != null) {
@@ -1308,45 +1032,6 @@ public class StmtExecutor {
         return Optional.empty();
     }
 
-    // Process set statement.
-    private void handleSetStmt() {
-        try {
-            SetStmt setStmt = (SetStmt) parsedStmt;
-            SetExecutor executor = new SetExecutor(context, setStmt);
-            executor.execute();
-        } catch (DdlException e) {
-            LOG.warn("", e);
-            // Return error message to client.
-            context.getState().setError(ErrorCode.ERR_LOCAL_VARIABLE, 
e.getMessage());
-            return;
-        }
-        context.getState().setOk();
-    }
-
-    // Process unset variable statement.
-    private void handleUnsetVariableStmt() {
-        try {
-            UnsetVariableStmt unsetStmt = (UnsetVariableStmt) parsedStmt;
-            if (unsetStmt.isApplyToAll()) {
-                
VariableMgr.setAllVarsToDefaultValue(context.getSessionVariable(), 
unsetStmt.getSetType());
-            } else {
-                String defaultValue = 
VariableMgr.getDefaultValue(unsetStmt.getVariable());
-                if (defaultValue == null) {
-                    
ErrorReport.reportDdlException(ErrorCode.ERR_UNKNOWN_SYSTEM_VARIABLE, 
unsetStmt.getVariable());
-                }
-                SetVar var = new SetVar(unsetStmt.getSetType(), 
unsetStmt.getVariable(),
-                        new StringLiteral(defaultValue), 
SetVarType.SET_SESSION_VAR);
-                VariableMgr.setVar(context.getSessionVariable(), var);
-            }
-        } catch (DdlException e) {
-            LOG.warn("", e);
-            // Return error message to client.
-            context.getState().setError(ErrorCode.ERR_LOCAL_VARIABLE, 
e.getMessage());
-            return;
-        }
-        context.getState().setOk();
-    }
-
     // send values from cache.
     // return true if the meta fields has been sent, otherwise, return false.
     // the meta fields must be sent right before the first batch of data(or 
eos flag).
@@ -1451,7 +1136,6 @@ public class StmtExecutor {
         if (queryStmt.isExplain()) {
             String explainString = 
planner.getExplainString(queryStmt.getExplainOptions());
             handleExplainStmt(explainString, false);
-            LOG.info("Query {} finished", DebugUtil.printId(context.queryId));
             return;
         }
 
@@ -1470,7 +1154,6 @@ public class StmtExecutor {
             if (resultSet.isPresent()) {
                 sendResultSet(resultSet.get(), ((Queriable) 
parsedStmt).getFieldInfos());
                 isHandleQueryInFe = true;
-                LOG.info("Query {} finished", 
DebugUtil.printId(context.queryId));
                 if (context.getSessionVariable().enableProfile()) {
                     if (profile != null) {
                         
this.profile.getSummaryProfile().setExecutedByFrontend(true);
@@ -1505,13 +1188,11 @@ public class StmtExecutor {
                 && parsedStmt.getOrigStmt() != null && 
parsedStmt.getOrigStmt().originStmt != null) {
             if (queryStmt instanceof LogicalPlanAdapter) {
                 handleCacheStmt(cacheAnalyzer, channel);
-                LOG.info("Query {} finished", 
DebugUtil.printId(context.queryId));
                 return;
             }
         }
 
         executeAndSendResult(isOutfileQuery, false, queryStmt, channel, null, 
null);
-        LOG.info("Query {} finished", DebugUtil.printId(context.queryId));
     }
 
     public void executeAndSendResult(boolean isOutfileQuery, boolean 
isSendFields,
@@ -1751,74 +1432,6 @@ public class StmtExecutor {
         }));
     }
 
-    private void handleUnsupportedStmt() {
-        if (context.getConnectType() == ConnectType.MYSQL) {
-            context.getMysqlChannel().reset();
-        }
-        // do nothing
-        context.getState().setOk();
-    }
-
-    // Process switch catalog
-    private void handleSwitchStmt() throws AnalysisException {
-        SwitchStmt switchStmt = (SwitchStmt) parsedStmt;
-        try {
-            context.getEnv().changeCatalog(context, 
switchStmt.getCatalogName());
-        } catch (DdlException e) {
-            LOG.warn("", e);
-            context.getState().setError(e.getMysqlErrorCode(), e.getMessage());
-            return;
-        }
-        context.getState().setOk();
-    }
-
-    // Process use statement.
-    private void handleUseStmt() throws AnalysisException {
-        UseStmt useStmt = (UseStmt) parsedStmt;
-        try {
-            if (useStmt.getCatalogName() != null) {
-                context.getEnv().changeCatalog(context, 
useStmt.getCatalogName());
-            }
-            context.getEnv().changeDb(context, useStmt.getDatabase());
-        } catch (DdlException e) {
-            LOG.warn("", e);
-            context.getState().setError(e.getMysqlErrorCode(), e.getMessage());
-            return;
-        }
-        context.getState().setOk();
-    }
-
-    private void handleUseCloudClusterStmt() throws AnalysisException {
-        if (!Config.isCloudMode()) {
-            ErrorReport.reportAnalysisException(ErrorCode.ERR_NOT_CLOUD_MODE);
-            return;
-        }
-
-        UseCloudClusterStmt useCloudClusterStmt = (UseCloudClusterStmt) 
parsedStmt;
-        try {
-            ((CloudEnv) 
context.getEnv()).changeCloudCluster(useCloudClusterStmt.getCluster(), context);
-        } catch (DdlException e) {
-            context.getState().setError(e.getMysqlErrorCode(), e.getMessage());
-            return;
-        }
-
-        if (Strings.isNullOrEmpty(useCloudClusterStmt.getDatabase())) {
-            return;
-        }
-
-        try {
-            if (useCloudClusterStmt.getCatalogName() != null) {
-                context.getEnv().changeCatalog(context, 
useCloudClusterStmt.getCatalogName());
-            }
-            context.getEnv().changeDb(context, 
useCloudClusterStmt.getDatabase());
-        } catch (DdlException e) {
-            context.getState().setError(e.getMysqlErrorCode(), e.getMessage());
-            return;
-        }
-
-        context.getState().setOk();
-    }
-
     private void sendMetaData(ResultSetMetaData metaData) throws IOException {
         sendMetaData(metaData, null);
     }
@@ -2081,47 +1694,6 @@ public class StmtExecutor {
         }
     }
 
-    // Process show statement
-    private void handleShow() throws IOException, AnalysisException, 
DdlException {
-        ShowExecutor executor = new ShowExecutor(context, (ShowStmt) 
parsedStmt);
-        ShowResultSet resultSet = executor.execute();
-        if (resultSet == null) {
-            // state changed in execute
-            return;
-        }
-        if (isProxy) {
-            proxyShowResultSet = resultSet;
-            return;
-        }
-
-        sendResultSet(resultSet);
-    }
-
-    private void handleUnlockTablesStmt() {
-    }
-
-    private void handleLockTablesStmt() {
-    }
-
-    public void handleShowConstraintStmt(List<List<String>> result) throws 
IOException {
-        ShowResultSetMetaData metaData = ShowResultSetMetaData.builder()
-                .addColumn(new Column("Name", ScalarType.createVarchar(20)))
-                .addColumn(new Column("Type", ScalarType.createVarchar(20)))
-                .addColumn(new Column("Definition", 
ScalarType.createVarchar(20)))
-                .build();
-        ResultSet resultSet = new ShowResultSet(metaData, result);
-        sendResultSet(resultSet);
-    }
-
-    public void handleShowCreateMTMVStmt(List<List<String>> result) throws 
IOException {
-        ShowResultSetMetaData metaData = ShowResultSetMetaData.builder()
-                .addColumn(new Column("Materialized View", 
ScalarType.createVarchar(20)))
-                .addColumn(new Column("Create Materialized View", 
ScalarType.createVarchar(30)))
-                .build();
-        ResultSet resultSet = new ShowResultSet(metaData, result);
-        sendResultSet(resultSet);
-    }
-
     public void handleExplainPlanProcessStmt(List<PlanProcess> result) throws 
IOException {
         ShowResultSetMetaData metaData = ShowResultSetMetaData.builder()
                 .addColumn(new Column("Rule", ScalarType.createVarchar(-1)))
@@ -2186,74 +1758,6 @@ public class StmtExecutor {
         context.getState().setEof();
     }
 
-    private void handleLoadStmt() {
-        try {
-            LoadStmt loadStmt = (LoadStmt) parsedStmt;
-            EtlJobType jobType = loadStmt.getEtlJobType();
-            if (jobType == EtlJobType.UNKNOWN) {
-                throw new DdlException("Unknown load job type");
-            }
-            LoadManager loadManager = context.getEnv().getLoadManager();
-            if (jobType == EtlJobType.LOCAL_FILE) {
-                if (!context.getCapability().supportClientLocalFile()) {
-                    
context.getState().setError(ErrorCode.ERR_NOT_ALLOWED_COMMAND, "This client is 
not support"
-                            + " to load client local file.");
-                    return;
-                }
-                String loadId = UUID.randomUUID().toString();
-                mysqlLoadId = loadId;
-                LoadJobRowResult submitResult = 
loadManager.getMysqlLoadManager()
-                        .executeMySqlLoadJobFromStmt(context, loadStmt, 
loadId);
-                context.getState().setOk(submitResult.getRecords(), 
submitResult.getWarnings(),
-                        submitResult.toString());
-            } else {
-                loadManager.createLoadJobFromStmt(loadStmt);
-                context.getState().setOk();
-            }
-        } catch (UserException e) {
-            // Return message to info client what happened.
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("DDL statement({}) process failed.", 
originStmt.originStmt, e);
-            }
-            context.getState().setError(e.getMysqlErrorCode(), e.getMessage());
-        } catch (Exception e) {
-            // Maybe our bug
-            LOG.warn("DDL statement(" + originStmt.originStmt + ") process 
failed.", e);
-            context.getState().setError(ErrorCode.ERR_UNKNOWN_ERROR, 
"Unexpected exception: " + e.getMessage());
-        }
-    }
-
-    private void handleDdlStmt() {
-        try {
-            DdlExecutor.execute(context.getEnv(), (DdlStmt) parsedStmt);
-            context.getState().setOk();
-            // copy into used
-            if (context.getState().getResultSet() != null) {
-                if (isProxy) {
-                    proxyShowResultSet = context.getState().getResultSet();
-                    return;
-                }
-                sendResultSet(context.getState().getResultSet());
-            }
-        } catch (QueryStateException e) {
-            LOG.warn("", e);
-            context.setState(e.getQueryState());
-        } catch (UserException e) {
-            // Return message to info client what happened.
-            LOG.warn("DDL statement({}) process failed.", 
originStmt.originStmt, e);
-            context.getState().setError(e.getMysqlErrorCode(), e.getMessage());
-        } catch (Exception e) {
-            // Maybe our bug
-            LOG.warn("DDL statement(" + originStmt.originStmt + ") process 
failed.", e);
-            context.getState().setError(ErrorCode.ERR_UNKNOWN_ERROR, 
"Unexpected exception: " + e.getMessage());
-        }
-    }
-
-    private void handleExportStmt() throws Exception {
-        ExportStmt exportStmt = (ExportStmt) parsedStmt;
-        
context.getEnv().getExportMgr().addExportJobAndRegisterTask(exportStmt.getExportJob());
-    }
-
     public Data.PQueryStatistics getQueryStatisticsForAuditLog() {
         if (statisticsForAuditLog == null) {
             statisticsForAuditLog = Data.PQueryStatistics.newBuilder();
diff --git a/fe/fe-core/src/test/java/org/apache/doris/qe/StmtExecutorTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/qe/StmtExecutorTest.java
index fab67abd25a..05af66313b1 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/qe/StmtExecutorTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/qe/StmtExecutorTest.java
@@ -23,21 +23,12 @@ import org.apache.doris.catalog.PrimitiveType;
 import org.apache.doris.common.Config;
 import org.apache.doris.common.FeConstants;
 import org.apache.doris.mysql.MysqlChannel;
-import org.apache.doris.mysql.MysqlCommand;
 import org.apache.doris.mysql.MysqlSerializer;
-import org.apache.doris.nereids.StatementContext;
-import org.apache.doris.nereids.exceptions.MustFallbackException;
-import org.apache.doris.nereids.glue.LogicalPlanAdapter;
-import org.apache.doris.nereids.trees.plans.commands.CreatePolicyCommand;
-import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
-import org.apache.doris.policy.PolicyTypeEnum;
 import org.apache.doris.qe.CommonResultSet.CommonResultSetMetaData;
 import org.apache.doris.qe.ConnectContext.ConnectType;
 import org.apache.doris.utframe.TestWithFeService;
 
 import com.google.common.collect.Lists;
-import mockit.Mock;
-import mockit.MockUp;
 import org.junit.Assert;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
@@ -198,32 +189,6 @@ public class StmtExecutorTest extends TestWithFeService {
         Assert.assertEquals(QueryState.MysqlStateType.OK, 
connectContext.getState().getStateType());
     }
 
-    @Test
-    public void testMustFallbackException() throws Exception {
-        ConnectContext connectContext = new ConnectContext();
-        connectContext.setSessionVariable(new SessionVariable());
-        new MockUp<ConnectContext>() {
-            @Mock
-            public MysqlCommand getCommand() {
-                return MysqlCommand.COM_STMT_PREPARE;
-            }
-        };
-
-        OriginStatement originStatement = new OriginStatement("create", 0);
-        StatementContext statementContext = new 
StatementContext(connectContext, originStatement);
-        LogicalPlan plan = new CreatePolicyCommand(PolicyTypeEnum.ROW, 
"test1", false, null, null, null, null, null, null);
-        LogicalPlanAdapter logicalPlanAdapter = new LogicalPlanAdapter(plan, 
statementContext);
-        logicalPlanAdapter.setOrigStmt(originStatement);
-        StmtExecutor stmtExecutor = new StmtExecutor(connectContext, 
logicalPlanAdapter);
-
-        try {
-            stmtExecutor.execute();
-        } catch (MustFallbackException e) {
-            Assertions.fail();
-            throw e;
-        }
-    }
-
     @Test
     public void testSendTextResultRow() throws IOException {
         ConnectContext mockCtx = Mockito.mock(ConnectContext.class);
@@ -295,8 +260,8 @@ public class StmtExecutorTest extends TestWithFeService {
         ResultSet resultSet = new CommonResultSet(new 
CommonResultSetMetaData(columns), rows);
         AtomicInteger i = new AtomicInteger();
         Mockito.doAnswer(invocation -> {
-            byte[] expected0 = new byte[]{0, 4, 7, -23, 7, 1, 1, 1, 2, 3};
-            byte[] expected1 = new byte[]{0, 0, -46, 4, 0, 0, 0, 0, 0, 0, 11, 
-23, 7, 1, 1, 1, 2, 3, 64, -30, 1, 0};
+            byte[] expected0 = new byte[] {0, 4, 7, -23, 7, 1, 1, 1, 2, 3};
+            byte[] expected1 = new byte[] {0, 0, -46, 4, 0, 0, 0, 0, 0, 0, 11, 
-23, 7, 1, 1, 1, 2, 3, 64, -30, 1, 0};
             ByteBuffer buffer = invocation.getArgument(0);
             if (i.get() == 0) {
                 Assertions.assertArrayEquals(expected0, buffer.array());


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to