This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 07b44477004 Refactor constructor of CancelBuildIndexStatement to empty
buildAttributes (#38290)
07b44477004 is described below
commit 07b444770040277207c5e38cf7ca3ef259641334
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Mar 2 00:26:07 2026 +0800
Refactor constructor of CancelBuildIndexStatement to empty buildAttributes
(#38290)
* Refactor constructor of CancelBuildIndexStatement to empty buildAttributes
* Refactor constructor of CancelBuildIndexStatement to empty buildAttributes
* Refactor constructor of CancelBuildIndexStatement to empty buildAttributes
* Refactor constructor of CancelBuildIndexStatement to empty buildAttributes
---
.../statement/type/DorisDDLStatementVisitor.java | 121 ++++++++++-----------
.../type/ddl/index/CancelBuildIndexStatement.java | 17 ++-
.../type/CancelBuildIndexStatementAssert.java | 14 ++-
3 files changed, 73 insertions(+), 79 deletions(-)
diff --git
a/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDDLStatementVisitor.java
b/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDDLStatementVisitor.java
index f15a000bbbb..757cb4044a6 100644
---
a/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDDLStatementVisitor.java
+++
b/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDDLStatementVisitor.java
@@ -24,20 +24,13 @@ import org.antlr.v4.runtime.misc.Interval;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import org.apache.shardingsphere.sql.parser.api.ASTNode;
import
org.apache.shardingsphere.sql.parser.api.visitor.statement.type.DDLStatementVisitor;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterCatalogContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.StandaloneAlterCommandsContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ResumeJobContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ResumeSyncJobContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PauseSyncJobContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.StopSyncJobContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateSyncJobContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ChannelDescriptionContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.BinlogDescriptionContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ColumnNameContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AddColumnContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AddRollupContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AddTableConstraintContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterAlgorithmOptionContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterCatalogContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterCheckContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterColocateGroupContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterCommandsModifierContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterConstraintContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterConvertContext;
@@ -49,9 +42,11 @@ import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterLi
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterListItemContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterLockOptionContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterLogfileGroupContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterPartitionContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterProcedureContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterRenameTableContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterServerContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterStoragePolicyContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterTableContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterTableDropContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterTablespaceContext;
@@ -59,24 +54,31 @@ import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterTa
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterTablespaceNdbContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterViewContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.BeginStatementContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropEncryptKeyContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.BinlogDescriptionContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.BuildIndexContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CancelAlterTableContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CancelBuildIndexContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CaseStatementContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ChangeColumnContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ChannelDescriptionContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CharsetNameContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ColumnDefinitionContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ColumnNameContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CompoundStatementContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateDatabaseContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateDefinitionClauseContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateEncryptKeyContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateEventContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateJobContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.JobScheduleExpressionContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateFileContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateFunctionContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateIndexContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateJobContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateLikeClauseContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateLogfileGroupContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateMaterializedViewContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateProcedureContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateServerContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateSyncJobContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateTableContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateTableOptionContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateTableOptionsContext;
@@ -84,69 +86,66 @@ import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateT
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateTriggerContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateViewContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DeallocateContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DistributedbyClauseContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DorisDropFunctionContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DorisPartitionDescContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropDatabaseContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropEncryptKeyContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropEventContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DorisDropFunctionContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropFileContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropIndexContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropLogfileGroupContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropProcedureContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropRollupContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropServerContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropTableContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropTablespaceContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropTriggerContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropViewContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.BuildIndexContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CancelBuildIndexContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CancelAlterTableContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ExecuteStmtContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.FieldDefinitionContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.FileNameContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.FlowControlStatementContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.FunctionNameContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.IdentifierContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.IfStatementContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.JobIdContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.JobScheduleExpressionContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.KeyListWithExpressionContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.KeyPartContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.KeyPartWithExpressionContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.KeyPartsContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.LoopStatementContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ModifyColumnContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ModifyDistributionClauseContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PartitionValueListContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PauseSyncJobContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PlaceContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PrepareContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertiesClauseContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertiesContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertyContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ReferenceDefinitionContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RenameColumnContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RenameIndexContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RenamePartitionContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RenameRollupContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RenameTableContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RepeatStatementContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ReplaceTableContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ResumeJobContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ResumeSyncJobContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RollupItemContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RollupNameItemContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RoutineBodyContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.SimpleStatementContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.StandaloneAlterCommandsContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.StopSyncJobContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.TableConstraintDefContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.TableElementContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.TableNameContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.TruncateTableContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ValidStatementContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.WhileStatementContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AddRollupContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropRollupContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RollupItemContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RollupNameItemContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RenameRollupContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RenamePartitionContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ReplaceTableContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterPartitionContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterColocateGroupContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterStoragePolicyContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DorisPartitionDescContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DistributedbyClauseContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ModifyDistributionClauseContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PartitionValueListContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertiesClauseContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertiesContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateEncryptKeyContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateFileContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DropFileContext;
-import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.FileNameContext;
import
org.apache.shardingsphere.sql.parser.engine.doris.visitor.statement.DorisStatementVisitor;
import
org.apache.shardingsphere.sql.parser.statement.core.enums.AlgorithmOption;
import
org.apache.shardingsphere.sql.parser.statement.core.enums.LockTableOption;
@@ -154,6 +153,7 @@ import
org.apache.shardingsphere.sql.parser.statement.core.segment.dal.Partition
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.AlterDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.CreateDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.charset.CharsetNameSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.colocategroup.ColocateGroupSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.column.ColumnDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.column.alter.AddColumnDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.column.alter.ChangeColumnDefinitionSegment;
@@ -176,13 +176,18 @@ import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.index.Dro
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.index.IndexNameSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.index.IndexSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.index.RenameIndexDefinitionSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.BinlogDescriptionSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.ChannelDescriptionSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.JobCommentSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.JobNameSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.JobScheduleIntervalSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.JobScheduleSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.JobScheduleTimestampSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.partition.AddPartitionDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.partition.AddPartitionsSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.partition.ModifyPartitionDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.partition.PartitionValuesSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.partition.RenamePartitionDefinitionSegment;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.IntervalUnitSegment;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.colocategroup.ColocateGroupSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.policy.PolicyNameSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.property.PropertiesSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.property.PropertySegment;
@@ -193,13 +198,6 @@ import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.rollup.Ro
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.routine.FunctionNameSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.routine.RoutineBodySegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.routine.ValidStatementSegment;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.JobCommentSegment;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.JobNameSegment;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.JobScheduleIntervalSegment;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.JobScheduleSegment;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.JobScheduleTimestampSegment;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.ChannelDescriptionSegment;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.job.BinlogDescriptionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.AlgorithmTypeSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.ConvertTableDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.CreateTableOptionSegment;
@@ -214,24 +212,28 @@ import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.Expr
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.SimpleExpressionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.CommentSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.DataTypeSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.IntervalUnitSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.OwnerSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateEncryptKeyStatement;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateFileStatement;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropEncryptKeyStatement;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropFileStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.DeallocateStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.ExecuteStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.PrepareStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.TruncateStatement;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.alter.CancelAlterTableStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.catalog.AlterCatalogStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.database.AlterDatabaseStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.database.CreateDatabaseStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.database.DropDatabaseStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.function.AlterFunctionStatement;
-import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.index.CreateIndexStatement;
-import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.index.DropIndexStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.index.BuildIndexStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.index.CancelBuildIndexStatement;
-import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.alter.CancelAlterTableStatement;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.index.CreateIndexStatement;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.index.DropIndexStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.procedure.AlterProcedureStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.procedure.CreateProcedureStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.procedure.DropProcedureStatement;
@@ -251,9 +253,6 @@ import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.vi
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.view.CreateMaterializedViewStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.view.CreateViewStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.view.DropViewStatement;
-import
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropEncryptKeyStatement;
-import
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateFileStatement;
-import
org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropFileStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.DeleteStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.InsertStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.SelectStatement;
@@ -264,12 +263,12 @@ import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.Iden
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisAlterColocateGroupStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisAlterStoragePolicyStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisCreateFunctionStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisCreateJobStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisCreateSyncJobStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisDropFunctionStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisPauseSyncJobStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisResumeJobStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisResumeSyncJobStatement;
-import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisPauseSyncJobStatement;
-import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisCreateSyncJobStatement;
-import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisCreateJobStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisStopSyncJobStatement;
import
org.apache.shardingsphere.sql.parser.statement.mysql.ddl.event.MySQLAlterEventStatement;
import
org.apache.shardingsphere.sql.parser.statement.mysql.ddl.event.MySQLCreateEventStatement;
@@ -1180,14 +1179,8 @@ public final class DorisDDLStatementVisitor extends
DorisStatementVisitor implem
@Override
public ASTNode visitCancelBuildIndex(final CancelBuildIndexContext ctx) {
- CancelBuildIndexStatement result = new
CancelBuildIndexStatement(getDatabaseType());
- result.setTable((SimpleTableSegment) visit(ctx.tableName()));
- if (null != ctx.jobIdList()) {
- for (JobIdContext each : ctx.jobIdList().jobId()) {
- result.getJobIds().add(each.getText());
- }
- }
- return result;
+ return new CancelBuildIndexStatement(getDatabaseType(),
(SimpleTableSegment) visit(ctx.tableName()),
+ null == ctx.jobIdList() ? Collections.emptyList() :
ctx.jobIdList().jobId().stream().map(RuleContext::getText).collect(Collectors.toList()));
}
@Override
diff --git
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/ddl/index/CancelBuildIndexStatement.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/ddl/index/CancelBuildIndexStatement.java
index 305725237bd..805e1aa9d1d 100644
---
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/ddl/index/CancelBuildIndexStatement.java
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/ddl/index/CancelBuildIndexStatement.java
@@ -18,35 +18,34 @@
package
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.index;
import lombok.Getter;
-import lombok.Setter;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.attribute.SQLStatementAttributes;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.attribute.type.TableSQLStatementAttribute;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.ddl.DDLStatement;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.Collection;
/**
* Cancel build index statement.
*/
@Getter
-@Setter
public final class CancelBuildIndexStatement extends DDLStatement {
- private SimpleTableSegment table;
+ private final SimpleTableSegment table;
- private final List<String> jobIds = new LinkedList<>();
+ private final Collection<String> jobIds;
- private SQLStatementAttributes attributes;
+ private final SQLStatementAttributes attributes;
- public CancelBuildIndexStatement(final DatabaseType databaseType) {
+ public CancelBuildIndexStatement(final DatabaseType databaseType, final
SimpleTableSegment table, final Collection<String> jobIds) {
super(databaseType);
+ this.table = table;
+ this.jobIds = jobIds;
+ attributes = new SQLStatementAttributes(new
TableSQLStatementAttribute(table));
}
@Override
public void buildAttributes() {
- attributes = new SQLStatementAttributes(new
TableSQLStatementAttribute(table));
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/CancelBuildIndexStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/CancelBuildIndexStatementAssert.java
index 1951d3a4d37..e6572e9dab0 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/CancelBuildIndexStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/CancelBuildIndexStatementAssert.java
@@ -24,8 +24,11 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAsse
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.table.TableAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.standard.index.CancelBuildIndexStatementTestCase;
-import static org.hamcrest.Matchers.is;
+import java.util.ArrayList;
+import java.util.List;
+
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -58,14 +61,13 @@ public final class CancelBuildIndexStatementAssert {
}
private static void assertJobIds(final SQLCaseAssertContext assertContext,
final CancelBuildIndexStatement actual, final CancelBuildIndexStatementTestCase
expected) {
- if (null == expected.getJobIds() || expected.getJobIds().isEmpty()) {
+ if (expected.getJobIds().isEmpty()) {
assertTrue(actual.getJobIds().isEmpty(),
assertContext.getText("Actual job IDs should not exist."));
} else {
- assertThat(assertContext.getText("Job IDs size assertion error: "),
- actual.getJobIds().size(),
is(expected.getJobIds().size()));
+ List<String> actualJobIds = new ArrayList<>(actual.getJobIds());
+ assertThat(assertContext.getText("Job IDs size assertion error:
"), actualJobIds.size(), is(expected.getJobIds().size()));
for (int i = 0; i < expected.getJobIds().size(); i++) {
- assertThat(assertContext.getText(String.format("Job ID
assertion error at index %d: ", i)),
- actual.getJobIds().get(i),
is(expected.getJobIds().get(i)));
+ assertThat(assertContext.getText(String.format("Job ID
assertion error at index %d: ", i)), actualJobIds.get(i),
is(expected.getJobIds().get(i)));
}
}
}