This is an automated email from the ASF dual-hosted git repository.

starocean999 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 279cab6ff82 [Enhancement](nereids) optimize getDdlStmt in Env (#54916)
279cab6ff82 is described below

commit 279cab6ff8265498e0186b2e4fa651e547732c78
Author: yaoxiao <[email protected]>
AuthorDate: Tue Aug 19 09:58:40 2025 +0800

    [Enhancement](nereids) optimize getDdlStmt in Env (#54916)
---
 .../src/main/java/org/apache/doris/catalog/Env.java  | 20 +++++++++-----------
 .../trees/plans/commands/CreateTableLikeCommand.java |  4 ++++
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
index 31b13333477..4c119988ea8 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
@@ -31,9 +31,7 @@ import org.apache.doris.analysis.AlterMultiPartitionClause;
 import org.apache.doris.analysis.AlterTableStmt;
 import org.apache.doris.analysis.ColumnRenameClause;
 import org.apache.doris.analysis.CreateMaterializedViewStmt;
-import org.apache.doris.analysis.CreateTableLikeStmt;
 import org.apache.doris.analysis.CreateTableStmt;
-import org.apache.doris.analysis.DdlStmt;
 import org.apache.doris.analysis.DistributionDesc;
 import org.apache.doris.analysis.DropPartitionClause;
 import org.apache.doris.analysis.Expr;
@@ -184,9 +182,11 @@ import 
org.apache.doris.nereids.trees.plans.commands.AnalyzeCommand;
 import org.apache.doris.nereids.trees.plans.commands.CancelAlterTableCommand;
 import org.apache.doris.nereids.trees.plans.commands.CancelBackupCommand;
 import org.apache.doris.nereids.trees.plans.commands.CancelBuildIndexCommand;
+import org.apache.doris.nereids.trees.plans.commands.Command;
 import org.apache.doris.nereids.trees.plans.commands.CreateDatabaseCommand;
 import 
org.apache.doris.nereids.trees.plans.commands.CreateMaterializedViewCommand;
 import org.apache.doris.nereids.trees.plans.commands.CreateTableCommand;
+import org.apache.doris.nereids.trees.plans.commands.CreateTableLikeCommand;
 import org.apache.doris.nereids.trees.plans.commands.CreateViewCommand;
 import 
org.apache.doris.nereids.trees.plans.commands.DropCatalogRecycleBinCommand.IdType;
 import org.apache.doris.nereids.trees.plans.commands.DropMTMVCommand;
@@ -4335,7 +4335,7 @@ public class Env {
      *
      * @param getDdlForLike Get schema for 'create table like' or not. when 
true, without hidden columns.
      */
-    public static void getDdlStmt(DdlStmt ddlStmt, String dbName, TableIf 
table, List<String> createTableStmt,
+    public static void getDdlStmt(Command command, String dbName, TableIf 
table, List<String> createTableStmt,
                                   List<String> addPartitionStmt, List<String> 
createRollupStmt,
                                   boolean separatePartition,
                                   boolean hidePassword, boolean getDdlForLike, 
long specificVersion,
@@ -4365,8 +4365,8 @@ public class Env {
         }
 
         // create table like a temporary table or create temporary table like 
a table
-        if (ddlStmt instanceof CreateTableLikeStmt) {
-            if (((CreateTableLikeStmt) ddlStmt).isTemp()) {
+        if (command instanceof CreateTableLikeCommand) {
+            if (((CreateTableLikeCommand) command).getInfo().isTemp()) {
                 sb.append("TEMPORARY ");
             }
         } else if (table.isTemporary()) {
@@ -4468,12 +4468,10 @@ public class Env {
             sb.append("\n").append(distributionInfo.toSql());
 
             // rollup index
-            if (ddlStmt instanceof CreateTableLikeStmt) {
-
-                CreateTableLikeStmt stmt = (CreateTableLikeStmt) ddlStmt;
-
-                ArrayList<String> rollupNames = stmt.getRollupNames();
-                boolean withAllRollup = stmt.isWithAllRollup();
+            if (command instanceof CreateTableLikeCommand) {
+                CreateTableLikeInfo info = ((CreateTableLikeCommand) 
command).getInfo();
+                ArrayList<String> rollupNames = info.getRollupNames();
+                boolean withAllRollup = info.isWithAllRollup();
                 List<Long> addIndexIdList = Lists.newArrayList();
 
                 if (!CollectionUtils.isEmpty(rollupNames)) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateTableLikeCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateTableLikeCommand.java
index ac1cdc99984..84df06c937f 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateTableLikeCommand.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateTableLikeCommand.java
@@ -125,4 +125,8 @@ public class CreateTableLikeCommand extends Command 
implements ForwardWithSync {
                 + e.getMessage(), e);
         }
     }
+
+    public CreateTableLikeInfo getInfo() {
+        return info;
+    }
 }


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

Reply via email to