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 21755d3c971 Support parsing Doris ALTER TABLE PARTITION syntax (#38167)
21755d3c971 is described below
commit 21755d3c971b679e89615efa087bc7c6c0bfc6b4
Author: cxy <[email protected]>
AuthorDate: Mon Feb 23 23:33:05 2026 +0800
Support parsing Doris ALTER TABLE PARTITION syntax (#38167)
---
.../src/main/antlr4/imports/doris/DDLStatement.g4 | 9 +
.../statement/type/DorisDDLStatementVisitor.java | 122 +++++++++++++
.../partition/AddPartitionDefinitionSegment.java | 121 +++++++++++++
.../ddl/partition/AddPartitionsSegment.java | 57 +++++++
.../ModifyPartitionDefinitionSegment.java | 56 ++++++
.../ddl/partition/PartitionValuesSegment.java | 57 +++++++
.../core/segment/generic/IntervalUnitSegment.java | 37 ++++
.../type/ddl/table/AlterTableStatement.java | 9 +
.../standard/type/AlterTableStatementAssert.java | 105 ++++++++++++
.../definition/ExpectedAddPartitionDefinition.java | 52 ++++++
.../ExpectedModifyPartitionDefinition.java | 46 +++++
.../impl/partition/ExpectedAddPartitions.java | 45 +++++
.../segment/impl/partition/ExpectedBuckets.java | 35 ++++
.../impl/partition/ExpectedIntervalUnit.java | 30 ++++
.../impl/partition/ExpectedPartitionValues.java | 45 +++++
.../table/AlterTableStatementTestCase.java | 12 ++
.../src/main/resources/case/ddl/alter-table.xml | 189 +++++++++++++++++++++
.../resources/sql/supported/ddl/alter-table.xml | 12 ++
18 files changed, 1039 insertions(+)
diff --git
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4
index 2326530f188..fe78261d54b 100644
---
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4
+++
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4
@@ -185,7 +185,11 @@ standaloneAlterCommands
alterPartition
: ADD PARTITION noWriteToBinLog? (partitionDefinitions | PARTITIONS
NUMBER_)
+ | ADD PARTITION ifNotExists? partitionName dorisPartitionDesc
(propertiesClause | LP_ properties RP_)? distributedbyClause?
+ | ADD PARTITIONS FROM LP_ expr RP_ TO LP_ expr RP_ INTERVAL expr
intervalUnit?
| DROP PARTITION identifierList
+ | MODIFY PARTITION LP_ (ASTERISK_ | identifierList) RP_ SET LP_ properties
RP_
+ | MODIFY PARTITION identifier SET LP_ properties RP_
| REBUILD PARTITION noWriteToBinLog? allOrPartitionNameList
| OPTIMIZE PARTITION noWriteToBinLog? allOrPartitionNameList
noWriteToBinLog?
| ANALYZE PARTITION noWriteToBinLog? allOrPartitionNameList
@@ -199,6 +203,11 @@ alterPartition
| IMPORT PARTITION allOrPartitionNameList TABLESPACE
;
+dorisPartitionDesc
+ : VALUES LESS THAN LP_ (MAXVALUE | partitionValueList) RP_
+ | VALUES LBT_ LP_ partitionValueList RP_ COMMA_ LP_ partitionValueList RP_
RP_
+ ;
+
constraintClause
: CONSTRAINT constraintName?
;
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 9e93f533b7a..e6716e515fd 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
@@ -126,7 +126,11 @@ import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.WhileSt
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.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.PartitionValueListContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertiesClauseContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateEncryptKeyContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateFileContext;
@@ -158,7 +162,12 @@ 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.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.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;
@@ -550,6 +559,14 @@ public final class DorisDDLStatementVisitor extends
DorisStatementVisitor implem
public ASTNode visitAlterTable(final AlterTableContext ctx) {
AlterTableStatement result = new
AlterTableStatement(getDatabaseType());
result.setTable((SimpleTableSegment) visit(ctx.tableName()));
+ if (null != ctx.standaloneAlterTableAction() && null !=
ctx.standaloneAlterTableAction().standaloneAlterCommands()
+ && null !=
ctx.standaloneAlterTableAction().standaloneAlterCommands().alterPartition()) {
+ AlterDefinitionSegment alterDefinition = (AlterDefinitionSegment)
visit(ctx.standaloneAlterTableAction().standaloneAlterCommands().alterPartition());
+ if (null != alterDefinition) {
+ setAlterDefinition(result, alterDefinition);
+ }
+ return result;
+ }
if (null == ctx.alterTableActions() || null ==
ctx.alterTableActions().alterCommandList() || null ==
ctx.alterTableActions().alterCommandList().alterList()) {
return result;
}
@@ -588,6 +605,12 @@ public final class DorisDDLStatementVisitor extends
DorisStatementVisitor implem
alterTableStatement.getRenameRollupDefinitions().add((RenameRollupDefinitionSegment)
alterDefinitionSegment);
} else if (alterDefinitionSegment instanceof
RenamePartitionDefinitionSegment) {
alterTableStatement.getRenamePartitionDefinitions().add((RenamePartitionDefinitionSegment)
alterDefinitionSegment);
+ } else if (alterDefinitionSegment instanceof
AddPartitionDefinitionSegment) {
+
alterTableStatement.getAddPartitionDefinitions().add((AddPartitionDefinitionSegment)
alterDefinitionSegment);
+ } else if (alterDefinitionSegment instanceof AddPartitionsSegment) {
+
alterTableStatement.getAddPartitionsSegments().add((AddPartitionsSegment)
alterDefinitionSegment);
+ } else if (alterDefinitionSegment instanceof
ModifyPartitionDefinitionSegment) {
+
alterTableStatement.getModifyPartitionDefinitions().add((ModifyPartitionDefinitionSegment)
alterDefinitionSegment);
} else if (alterDefinitionSegment instanceof AlgorithmTypeSegment) {
alterTableStatement.setAlgorithmSegment((AlgorithmTypeSegment)
alterDefinitionSegment);
} else if (alterDefinitionSegment instanceof LockTableSegment) {
@@ -1054,6 +1077,105 @@ public final class DorisDDLStatementVisitor extends
DorisStatementVisitor implem
return new RenamePartitionDefinitionSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), oldPartitionSegment, newPartitionSegment);
}
+ @Override
+ public ASTNode visitAlterPartition(final AlterPartitionContext ctx) {
+ if (null != ctx.ADD() && null != ctx.PARTITION() && null !=
ctx.partitionName() && null != ctx.dorisPartitionDesc()) {
+ return visitAddPartitionDoris(ctx);
+ }
+ if (null != ctx.ADD() && null != ctx.PARTITIONS() && null !=
ctx.FROM() && null != ctx.TO() && null != ctx.INTERVAL()) {
+ return visitAddPartitionsDoris(ctx);
+ }
+ if (null != ctx.MODIFY() && null != ctx.PARTITION()) {
+ return visitModifyPartitionDoris(ctx);
+ }
+ return null;
+ }
+
+ private AddPartitionDefinitionSegment visitAddPartitionDoris(final
AlterPartitionContext ctx) {
+ PartitionSegment partitionSegment =
+ new
PartitionSegment(ctx.partitionName().start.getStartIndex(),
ctx.partitionName().stop.getStopIndex(), (IdentifierValue)
visit(ctx.partitionName().identifier()));
+ AddPartitionDefinitionSegment result = new
AddPartitionDefinitionSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), partitionSegment);
+ if (null != ctx.dorisPartitionDesc()) {
+ result.setPartitionValues((PartitionValuesSegment)
visit(ctx.dorisPartitionDesc()));
+ }
+ if (null != ctx.propertiesClause()) {
+
result.setProperties(extractPropertiesSegment(ctx.propertiesClause()));
+ } else if (null != ctx.properties()) {
+ PropertiesSegment propertiesSegment = new
PropertiesSegment(ctx.properties().start.getStartIndex(),
ctx.properties().stop.getStopIndex());
+ for (PropertyContext each : ctx.properties().property()) {
+
propertiesSegment.getProperties().add(createPropertySegment(each));
+ }
+ result.setProperties(propertiesSegment);
+ }
+ if (null != ctx.distributedbyClause()) {
+ DistributedbyClauseContext distCtx = ctx.distributedbyClause();
+ result.setDistributedColumn((ColumnSegment)
visit(distCtx.columnName()));
+ result.setBuckets(Integer.parseInt(distCtx.NUMBER_().getText()));
+ }
+ return result;
+ }
+
+ @Override
+ public ASTNode visitDorisPartitionDesc(final DorisPartitionDescContext
ctx) {
+ if (null != ctx.VALUES() && null != ctx.LESS() && null != ctx.THAN()) {
+ PartitionValuesSegment result = new
PartitionValuesSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PartitionValuesSegment.PartitionValuesType.VALUES_LESS_THAN);
+ if (null != ctx.MAXVALUE()) {
+ result.setMaxValue(true);
+ } else if (!ctx.partitionValueList().isEmpty()) {
+ PartitionValueListContext valueListCtx =
ctx.partitionValueList(0);
+ for (int i = 0; i < valueListCtx.expr().size(); i++) {
+ result.getValues().add((ExpressionSegment)
visit(valueListCtx.expr(i)));
+ }
+ }
+ return result;
+ }
+ if (null != ctx.VALUES() && null != ctx.LBT_()) {
+ PartitionValuesSegment result = new
PartitionValuesSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
PartitionValuesSegment.PartitionValuesType.VALUES_RANGE);
+ for (PartitionValueListContext each : ctx.partitionValueList()) {
+ for (int i = 0; i < each.expr().size(); i++) {
+ result.getValues().add((ExpressionSegment)
visit(each.expr(i)));
+ }
+ }
+ return result;
+ }
+ return null;
+ }
+
+ private AddPartitionsSegment visitAddPartitionsDoris(final
AlterPartitionContext ctx) {
+ ExpressionSegment fromValue = (ExpressionSegment) visit(ctx.expr(0));
+ ExpressionSegment toValue = (ExpressionSegment) visit(ctx.expr(1));
+ ExpressionSegment intervalValue = (ExpressionSegment)
visit(ctx.expr(2));
+ AddPartitionsSegment result = new
AddPartitionsSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(),
fromValue, toValue, intervalValue);
+ if (null != ctx.intervalUnit()) {
+ int startIndex = ctx.intervalUnit().getStart().getStartIndex();
+ int stopIndex = ctx.intervalUnit().getStop().getStopIndex();
+ IdentifierValue identifier = new
IdentifierValue(ctx.intervalUnit().getText());
+ result.setIntervalUnit(new IntervalUnitSegment(startIndex,
stopIndex, identifier));
+ }
+ return result;
+ }
+
+ private ModifyPartitionDefinitionSegment visitModifyPartitionDoris(final
AlterPartitionContext ctx) {
+ PropertiesSegment properties = new
PropertiesSegment(ctx.properties().start.getStartIndex(),
ctx.properties().stop.getStopIndex());
+ for (PropertyContext each : ctx.properties().property()) {
+ properties.getProperties().add(createPropertySegment(each));
+ }
+ if (null != ctx.ASTERISK_()) {
+ return new
ModifyPartitionDefinitionSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), properties, true);
+ }
+ ModifyPartitionDefinitionSegment result = new
ModifyPartitionDefinitionSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), properties, false);
+ if (null != ctx.identifier() && ctx.identifierList() == null) {
+ PartitionSegment partition = new
PartitionSegment(ctx.identifier().start.getStartIndex(),
ctx.identifier().stop.getStopIndex(), (IdentifierValue)
visit(ctx.identifier()));
+ result.getPartitions().add(partition);
+ } else if (null != ctx.identifierList()) {
+ for (IdentifierContext each : ctx.identifierList().identifier()) {
+ PartitionSegment partition = new
PartitionSegment(each.start.getStartIndex(), each.stop.getStopIndex(),
(IdentifierValue) visit(each));
+ result.getPartitions().add(partition);
+ }
+ }
+ return result;
+ }
+
@Override
public ASTNode visitAlterStoragePolicy(final AlterStoragePolicyContext
ctx) {
IdentifierValue identifier = (IdentifierValue) visit(ctx.identifier());
diff --git
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/AddPartitionDefinitionSegment.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/AddPartitionDefinitionSegment.java
new file mode 100644
index 00000000000..0987033ad1c
--- /dev/null
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/AddPartitionDefinitionSegment.java
@@ -0,0 +1,121 @@
+/*
+ * 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.shardingsphere.sql.parser.statement.core.segment.ddl.partition;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dal.PartitionSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.AlterDefinitionSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.property.PropertiesSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
+
+import java.util.Optional;
+
+/**
+ * Add partition definition segment.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class AddPartitionDefinitionSegment implements
AlterDefinitionSegment {
+
+ private final int startIndex;
+
+ private final int stopIndex;
+
+ private final PartitionSegment partition;
+
+ private PartitionValuesSegment partitionValues;
+
+ private PropertiesSegment properties;
+
+ private ColumnSegment distributedColumn;
+
+ private Integer buckets;
+
+ /**
+ * Set partition values.
+ *
+ * @param partitionValues partition values
+ */
+ public void setPartitionValues(final PartitionValuesSegment
partitionValues) {
+ this.partitionValues = partitionValues;
+ }
+
+ /**
+ * Get partition values.
+ *
+ * @return partition values
+ */
+ public Optional<PartitionValuesSegment> getPartitionValues() {
+ return Optional.ofNullable(partitionValues);
+ }
+
+ /**
+ * Set properties.
+ *
+ * @param properties properties
+ */
+ public void setProperties(final PropertiesSegment properties) {
+ this.properties = properties;
+ }
+
+ /**
+ * Get properties.
+ *
+ * @return properties
+ */
+ public Optional<PropertiesSegment> getProperties() {
+ return Optional.ofNullable(properties);
+ }
+
+ /**
+ * Set distributed column.
+ *
+ * @param distributedColumn distributed column
+ */
+ public void setDistributedColumn(final ColumnSegment distributedColumn) {
+ this.distributedColumn = distributedColumn;
+ }
+
+ /**
+ * Get distributed column.
+ *
+ * @return distributed column
+ */
+ public Optional<ColumnSegment> getDistributedColumn() {
+ return Optional.ofNullable(distributedColumn);
+ }
+
+ /**
+ * Set buckets.
+ *
+ * @param buckets buckets
+ */
+ public void setBuckets(final Integer buckets) {
+ this.buckets = buckets;
+ }
+
+ /**
+ * Get buckets.
+ *
+ * @return buckets
+ */
+ public Optional<Integer> getBuckets() {
+ return Optional.ofNullable(buckets);
+ }
+}
diff --git
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/AddPartitionsSegment.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/AddPartitionsSegment.java
new file mode 100644
index 00000000000..4a6b6aa2544
--- /dev/null
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/AddPartitionsSegment.java
@@ -0,0 +1,57 @@
+/*
+ * 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.shardingsphere.sql.parser.statement.core.segment.ddl.partition;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.AlterDefinitionSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.IntervalUnitSegment;
+
+import java.util.Optional;
+
+/**
+ * Add partitions segment for batch partition creation.
+ */
+@RequiredArgsConstructor
+@Getter
+@Setter
+public final class AddPartitionsSegment implements AlterDefinitionSegment {
+
+ private final int startIndex;
+
+ private final int stopIndex;
+
+ private final ExpressionSegment fromValue;
+
+ private final ExpressionSegment toValue;
+
+ private final ExpressionSegment intervalValue;
+
+ private IntervalUnitSegment intervalUnit;
+
+ /**
+ * Get interval unit.
+ *
+ * @return interval unit
+ */
+ public Optional<IntervalUnitSegment> getIntervalUnit() {
+ return Optional.ofNullable(intervalUnit);
+ }
+}
diff --git
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/ModifyPartitionDefinitionSegment.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/ModifyPartitionDefinitionSegment.java
new file mode 100644
index 00000000000..298b7bbd2cc
--- /dev/null
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/ModifyPartitionDefinitionSegment.java
@@ -0,0 +1,56 @@
+/*
+ * 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.shardingsphere.sql.parser.statement.core.segment.ddl.partition;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dal.PartitionSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.AlterDefinitionSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.property.PropertiesSegment;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * Modify partition definition segment.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class ModifyPartitionDefinitionSegment implements
AlterDefinitionSegment {
+
+ private final int startIndex;
+
+ private final int stopIndex;
+
+ private final Collection<PartitionSegment> partitions = new LinkedList<>();
+
+ private final PropertiesSegment properties;
+
+ private final boolean allPartitions;
+
+ /**
+ * Constructor for single partition.
+ *
+ * @param startIndex start index
+ * @param stopIndex stop index
+ * @param properties properties
+ */
+ public ModifyPartitionDefinitionSegment(final int startIndex, final int
stopIndex, final PropertiesSegment properties) {
+ this(startIndex, stopIndex, properties, false);
+ }
+}
diff --git
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/PartitionValuesSegment.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/PartitionValuesSegment.java
new file mode 100644
index 00000000000..115a3e43713
--- /dev/null
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/PartitionValuesSegment.java
@@ -0,0 +1,57 @@
+/*
+ * 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.shardingsphere.sql.parser.statement.core.segment.ddl.partition;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.sql.parser.statement.core.segment.SQLSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * Partition values segment.
+ */
+@Getter
+@Setter
+public final class PartitionValuesSegment implements SQLSegment {
+
+ private final int startIndex;
+
+ private final int stopIndex;
+
+ private final PartitionValuesType valuesType;
+
+ private final Collection<ExpressionSegment> values = new LinkedList<>();
+
+ private boolean isMaxValue;
+
+ public PartitionValuesSegment(final int startIndex, final int stopIndex,
final PartitionValuesType valuesType) {
+ this.startIndex = startIndex;
+ this.stopIndex = stopIndex;
+ this.valuesType = valuesType;
+ }
+
+ /**
+ * Partition values type.
+ */
+ public enum PartitionValuesType {
+ VALUES_LESS_THAN, VALUES_RANGE
+ }
+}
diff --git
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/generic/IntervalUnitSegment.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/generic/IntervalUnitSegment.java
new file mode 100644
index 00000000000..f9094d45644
--- /dev/null
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/generic/IntervalUnitSegment.java
@@ -0,0 +1,37 @@
+/*
+ * 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.shardingsphere.sql.parser.statement.core.segment.generic;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.sql.parser.statement.core.segment.SQLSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
+
+/**
+ * Interval unit segment.
+ */
+@RequiredArgsConstructor
+@Getter
+public final class IntervalUnitSegment implements SQLSegment {
+
+ private final int startIndex;
+
+ private final int stopIndex;
+
+ private final IdentifierValue identifier;
+}
diff --git
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/ddl/table/AlterTableStatement.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/ddl/table/AlterTableStatement.java
index 92e849d41ca..5c8ecfc3e83 100644
---
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/ddl/table/AlterTableStatement.java
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/ddl/table/AlterTableStatement.java
@@ -36,6 +36,9 @@ import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.constrain
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.index.DropIndexDefinitionSegment;
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.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.RenamePartitionDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.primary.DropPrimaryKeyDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.rollup.RenameRollupDefinitionSegment;
@@ -107,6 +110,12 @@ public final class AlterTableStatement extends
DDLStatement {
private final Collection<RenamePartitionDefinitionSegment>
renamePartitionDefinitions = new LinkedList<>();
+ private final Collection<AddPartitionDefinitionSegment>
addPartitionDefinitions = new LinkedList<>();
+
+ private final Collection<AddPartitionsSegment> addPartitionsSegments = new
LinkedList<>();
+
+ private final Collection<ModifyPartitionDefinitionSegment>
modifyPartitionDefinitions = new LinkedList<>();
+
private SQLStatementAttributes attributes;
public AlterTableStatement(final DatabaseType databaseType) {
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/AlterTableStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/AlterTableStatementAssert.java
index 8b7b6fa4b65..eff989a26f7 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/AlterTableStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/standard/type/AlterTableStatementAssert.java
@@ -19,6 +19,7 @@ package
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dal.PartitionSegment;
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;
@@ -29,7 +30,12 @@ import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.column.al
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.constraint.alter.AddConstraintDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.constraint.alter.ModifyConstraintDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.index.RenameIndexDefinitionSegment;
+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.dml.expr.ExpressionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.primary.DropPrimaryKeyDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.rollup.RenameRollupDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.ConvertTableDefinitionSegment;
@@ -58,10 +64,14 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.s
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition.ExpectedModifyColumnDefinition;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition.ExpectedRenameColumnDefinition;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition.ExpectedRenameIndexDefinition;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition.ExpectedAddPartitionDefinition;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition.ExpectedModifyPartitionDefinition;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition.ExpectedRenamePartitionDefinition;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition.ExpectedRenameRollupDefinition;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.partition.ExpectedAddPartitions;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.distsql.ExpectedProperties;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.distsql.ExpectedProperty;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.partition.ExpectedPartitionValues;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.standard.table.AlterTableStatementTestCase;
import java.util.Collection;
@@ -103,6 +113,9 @@ public final class AlterTableStatementAssert {
assertRenameColumnDefinitions(assertContext, actual, expected);
assertRenameRollupDefinitions(assertContext, actual, expected);
assertRenamePartitionDefinitions(assertContext, actual, expected);
+ assertAddPartitionDefinitions(assertContext, actual, expected);
+ assertModifyPartitionDefinitions(assertContext, actual, expected);
+ assertAddPartitionsSegments(assertContext, actual, expected);
assertConvertTable(assertContext, actual, expected);
assertModifyCollectionRetrievalDefinitions(assertContext, actual,
expected);
assertDropPrimaryKeyDefinition(assertContext, actual, expected);
@@ -318,6 +331,98 @@ public final class AlterTableStatementAssert {
}
}
+ private static void assertAddPartitionDefinitions(final
SQLCaseAssertContext assertContext, final AlterTableStatement actual, final
AlterTableStatementTestCase expected) {
+ assertThat(assertContext.getText("Add partition definitions size
assertion error: "), actual.getAddPartitionDefinitions().size(),
is(expected.getAddPartitions().size()));
+ int count = 0;
+ for (AddPartitionDefinitionSegment each :
actual.getAddPartitionDefinitions()) {
+ ExpectedAddPartitionDefinition expectedAddPartition =
expected.getAddPartitions().get(count);
+ PartitionAssert.assertIs(assertContext, each.getPartition(),
expectedAddPartition.getPartition());
+ if (each.getPartitionValues().isPresent()) {
+ assertNotNull(expectedAddPartition.getPartitionValues(),
assertContext.getText("Expected partition values should exist."));
+ assertPartitionValues(assertContext,
each.getPartitionValues().get(), expectedAddPartition.getPartitionValues());
+ } else {
+ assertNull(expectedAddPartition.getPartitionValues(),
assertContext.getText("Expected partition values should not exist."));
+ }
+ if (each.getProperties().isPresent()) {
+ assertNotNull(expectedAddPartition.getProperties(),
assertContext.getText("Expected properties should exist."));
+ assertProperties(assertContext, each.getProperties().get(),
expectedAddPartition.getProperties());
+ } else {
+ assertNull(expectedAddPartition.getProperties(),
assertContext.getText("Expected properties should not exist."));
+ }
+ if (each.getDistributedColumn().isPresent()) {
+ assertNotNull(expectedAddPartition.getDistributedColumn(),
assertContext.getText("Expected distributed column should exist."));
+ ColumnAssert.assertIs(assertContext,
each.getDistributedColumn().get(), expectedAddPartition.getDistributedColumn());
+ } else {
+ assertNull(expectedAddPartition.getDistributedColumn(),
assertContext.getText("Expected distributed column should not exist."));
+ }
+ if (each.getBuckets().isPresent()) {
+ assertNotNull(expectedAddPartition.getBuckets(),
assertContext.getText("Expected buckets should exist."));
+ assertThat(assertContext.getText("Buckets value assertion
error: "), each.getBuckets().get(),
is(Integer.parseInt(expectedAddPartition.getBuckets().getValue())));
+ } else {
+ assertNull(expectedAddPartition.getBuckets(),
assertContext.getText("Expected buckets should not exist."));
+ }
+ SQLSegmentAssert.assertIs(assertContext, each,
expectedAddPartition);
+ count++;
+ }
+ }
+
+ private static void assertPartitionValues(final SQLCaseAssertContext
assertContext, final PartitionValuesSegment actual, final
ExpectedPartitionValues expected) {
+ assertThat(assertContext.getText("Partition values type assertion
error: "), actual.getValuesType().name(), is(expected.getType()));
+ if (null != expected.getIsMaxValue()) {
+ assertThat(assertContext.getText("Partition values max value
assertion error: "), actual.isMaxValue(), is(expected.getIsMaxValue()));
+ }
+ assertThat(assertContext.getText("Partition values size assertion
error: "), actual.getValues().size(), is(expected.getValues().size()));
+ int count = 0;
+ for (ExpressionSegment each : actual.getValues()) {
+ ExpressionAssert.assertExpression(assertContext, each,
expected.getValues().get(count));
+ count++;
+ }
+ SQLSegmentAssert.assertIs(assertContext, actual, expected);
+ }
+
+ private static void assertModifyPartitionDefinitions(final
SQLCaseAssertContext assertContext, final AlterTableStatement actual, final
AlterTableStatementTestCase expected) {
+ assertThat(assertContext.getText("Modify partition definitions size
assertion error: "), actual.getModifyPartitionDefinitions().size(),
is(expected.getModifyPartitions().size()));
+ int count = 0;
+ for (ModifyPartitionDefinitionSegment each :
actual.getModifyPartitionDefinitions()) {
+ ExpectedModifyPartitionDefinition expectedModifyPartition =
expected.getModifyPartitions().get(count);
+ if (null != expectedModifyPartition.getAllPartitions()) {
+ assertThat(assertContext.getText("Modify partition all
partitions assertion error: "), each.isAllPartitions(),
is(expectedModifyPartition.getAllPartitions()));
+ }
+ assertThat(assertContext.getText("Modify partition partitions size
assertion error: "), each.getPartitions().size(),
is(expectedModifyPartition.getPartitions().size()));
+ int partitionCount = 0;
+ for (PartitionSegment partition : each.getPartitions()) {
+ PartitionAssert.assertIs(assertContext, partition,
expectedModifyPartition.getPartitions().get(partitionCount));
+ partitionCount++;
+ }
+ assertNotNull(each.getProperties(), assertContext.getText("Actual
properties should exist."));
+ assertNotNull(expectedModifyPartition.getProperties(),
assertContext.getText("Expected properties should exist."));
+ assertProperties(assertContext, each.getProperties(),
expectedModifyPartition.getProperties());
+ SQLSegmentAssert.assertIs(assertContext, each,
expectedModifyPartition);
+ count++;
+ }
+ }
+
+ private static void assertAddPartitionsSegments(final SQLCaseAssertContext
assertContext, final AlterTableStatement actual, final
AlterTableStatementTestCase expected) {
+ assertThat(assertContext.getText("Add partitions segments size
assertion error: "), actual.getAddPartitionsSegments().size(),
is(expected.getAddPartitionsList().size()));
+ int count = 0;
+ for (AddPartitionsSegment each : actual.getAddPartitionsSegments()) {
+ ExpectedAddPartitions expectedAddPartitions =
expected.getAddPartitionsList().get(count);
+ ExpressionAssert.assertExpression(assertContext,
each.getFromValue(), expectedAddPartitions.getFromValue());
+ ExpressionAssert.assertExpression(assertContext,
each.getToValue(), expectedAddPartitions.getToValue());
+ ExpressionAssert.assertExpression(assertContext,
each.getIntervalValue(), expectedAddPartitions.getIntervalValue());
+ if (each.getIntervalUnit().isPresent()) {
+ assertNotNull(expectedAddPartitions.getIntervalUnit(),
assertContext.getText("Expected interval unit should exist."));
+ assertThat(assertContext.getText("Interval unit value
assertion error: "), each.getIntervalUnit().get().getIdentifier().getValue(),
+ is(expectedAddPartitions.getIntervalUnit().getName()));
+ SQLSegmentAssert.assertIs(assertContext,
each.getIntervalUnit().get(), expectedAddPartitions.getIntervalUnit());
+ } else {
+ assertNull(expectedAddPartitions.getIntervalUnit(),
assertContext.getText("Expected interval unit should not exist."));
+ }
+ SQLSegmentAssert.assertIs(assertContext, each,
expectedAddPartitions);
+ count++;
+ }
+ }
+
private static void assertModifyCollectionRetrievalDefinitions(final
SQLCaseAssertContext assertContext, final AlterTableStatement actual, final
AlterTableStatementTestCase expected) {
Optional<ModifyCollectionRetrievalSegment> modifyCollectionRetrieval =
actual.getModifyCollectionRetrieval();
if (null == expected.getModifyCollectionRetrievalDefinition()) {
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/definition/ExpectedAddPartitionDefinition.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/definition/ExpectedAddPartitionDefinition.java
new file mode 100644
index 00000000000..f31ef6f5e6d
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/definition/ExpectedAddPartitionDefinition.java
@@ -0,0 +1,52 @@
+/*
+ * 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.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition;
+
+import lombok.Getter;
+import lombok.Setter;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.AbstractExpectedSQLSegment;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.column.ExpectedColumn;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.index.ExpectedPartition;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.partition.ExpectedPartitionValues;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.partition.ExpectedBuckets;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.distsql.ExpectedProperties;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * Expected add partition definition.
+ */
+@Getter
+@Setter
+public final class ExpectedAddPartitionDefinition extends
AbstractExpectedSQLSegment {
+
+ @XmlElement(name = "partition")
+ private ExpectedPartition partition;
+
+ @XmlElement(name = "partition-values")
+ private ExpectedPartitionValues partitionValues;
+
+ @XmlElement(name = "properties")
+ private ExpectedProperties properties;
+
+ @XmlElement(name = "distributed-column")
+ private ExpectedColumn distributedColumn;
+
+ @XmlElement(name = "buckets")
+ private ExpectedBuckets buckets;
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/definition/ExpectedModifyPartitionDefinition.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/definition/ExpectedModifyPartitionDefinition.java
new file mode 100644
index 00000000000..a5a005ab669
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/definition/ExpectedModifyPartitionDefinition.java
@@ -0,0 +1,46 @@
+/*
+ * 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.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition;
+
+import lombok.Getter;
+import lombok.Setter;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.AbstractExpectedSQLSegment;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.index.ExpectedPartition;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.distsql.ExpectedProperties;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Expected modify partition definition.
+ */
+@Getter
+@Setter
+public final class ExpectedModifyPartitionDefinition extends
AbstractExpectedSQLSegment {
+
+ @XmlAttribute(name = "all-partitions")
+ private Boolean allPartitions;
+
+ @XmlElement(name = "partition")
+ private final List<ExpectedPartition> partitions = new LinkedList<>();
+
+ @XmlElement(name = "properties")
+ private ExpectedProperties properties;
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/partition/ExpectedAddPartitions.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/partition/ExpectedAddPartitions.java
new file mode 100644
index 00000000000..792a4f1b321
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/partition/ExpectedAddPartitions.java
@@ -0,0 +1,45 @@
+/*
+ * 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.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.partition;
+
+import lombok.Getter;
+import lombok.Setter;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.AbstractExpectedSQLSegment;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.expr.ExpectedExpression;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * Expected add partitions (batch).
+ */
+@Getter
+@Setter
+public final class ExpectedAddPartitions extends AbstractExpectedSQLSegment {
+
+ @XmlElement(name = "from-value")
+ private ExpectedExpression fromValue;
+
+ @XmlElement(name = "to-value")
+ private ExpectedExpression toValue;
+
+ @XmlElement(name = "interval-value")
+ private ExpectedExpression intervalValue;
+
+ @XmlElement(name = "interval-unit")
+ private ExpectedIntervalUnit intervalUnit;
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/partition/ExpectedBuckets.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/partition/ExpectedBuckets.java
new file mode 100644
index 00000000000..cb024fed565
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/partition/ExpectedBuckets.java
@@ -0,0 +1,35 @@
+/*
+ * 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.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.partition;
+
+import lombok.Getter;
+import lombok.Setter;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.AbstractExpectedSQLSegment;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * Expected buckets.
+ */
+@Getter
+@Setter
+public final class ExpectedBuckets extends AbstractExpectedSQLSegment {
+
+ @XmlAttribute
+ private String value;
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/partition/ExpectedIntervalUnit.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/partition/ExpectedIntervalUnit.java
new file mode 100644
index 00000000000..4e1f746b26e
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/partition/ExpectedIntervalUnit.java
@@ -0,0 +1,30 @@
+/*
+ * 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.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.partition;
+
+import lombok.Getter;
+import lombok.Setter;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.AbstractExpectedIdentifierSQLSegment;
+
+/**
+ * Expected interval unit.
+ */
+@Getter
+@Setter
+public final class ExpectedIntervalUnit extends
AbstractExpectedIdentifierSQLSegment {
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/partition/ExpectedPartitionValues.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/partition/ExpectedPartitionValues.java
new file mode 100644
index 00000000000..c21063f9292
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/partition/ExpectedPartitionValues.java
@@ -0,0 +1,45 @@
+/*
+ * 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.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.partition;
+
+import lombok.Getter;
+import lombok.Setter;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.AbstractExpectedSQLSegment;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.expr.ExpectedExpression;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Expected partition values.
+ */
+@Getter
+@Setter
+public final class ExpectedPartitionValues extends AbstractExpectedSQLSegment {
+
+ @XmlAttribute
+ private String type;
+
+ @XmlAttribute(name = "is-max-value")
+ private Boolean isMaxValue;
+
+ @XmlElement(name = "value")
+ private final List<ExpectedExpression> values = new LinkedList<>();
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/standard/table/AlterTableStatementTestCase.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/standard/table/AlterTableStatementTestCase.java
index a740b6b477e..3b2a51880bf 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/standard/table/AlterTableStatementTestCase.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/standard/table/AlterTableStatementTestCase.java
@@ -33,6 +33,9 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.s
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition.ExpectedRenamePartitionDefinition;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition.ExpectedRenameRollupDefinition;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition.ExpectedReplaceTableDefinition;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition.ExpectedAddPartitionDefinition;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition.ExpectedModifyPartitionDefinition;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.partition.ExpectedAddPartitions;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.table.ExpectedSimpleTable;
import javax.xml.bind.annotation.XmlElement;
@@ -85,6 +88,15 @@ public final class AlterTableStatementTestCase extends
SQLParserTestCase {
@XmlElement(name = "rename-partition")
private final List<ExpectedRenamePartitionDefinition> renamePartitions =
new LinkedList<>();
+ @XmlElement(name = "add-partition")
+ private final List<ExpectedAddPartitionDefinition> addPartitions = new
LinkedList<>();
+
+ @XmlElement(name = "add-partitions")
+ private final List<ExpectedAddPartitions> addPartitionsList = new
LinkedList<>();
+
+ @XmlElement(name = "modify-partition")
+ private final List<ExpectedModifyPartitionDefinition> modifyPartitions =
new LinkedList<>();
+
@XmlElement(name = "drop-column")
private final List<ExpectedColumn> dropColumns = new LinkedList<>();
diff --git a/test/it/parser/src/main/resources/case/ddl/alter-table.xml
b/test/it/parser/src/main/resources/case/ddl/alter-table.xml
index 350cbd53a82..e4fa7575109 100644
--- a/test/it/parser/src/main/resources/case/ddl/alter-table.xml
+++ b/test/it/parser/src/main/resources/case/ddl/alter-table.xml
@@ -2802,4 +2802,193 @@
</properties>
</replace-table>
</alter-table>
+
+ <alter-table
sql-case-id="alter_table_add_partition_values_less_than_doris">
+ <table name="my_table" start-index="12" stop-index="30">
+ <owner name="example_db" start-index="12" stop-index="21" />
+ </table>
+ <add-partition start-index="32" stop-index="114">
+ <partition name="p1" start-index="46" stop-index="47" />
+ <partition-values start-index="49" stop-index="79"
type="VALUES_LESS_THAN">
+ <value>
+ <literal-expression value="2015-01-01" start-index="67"
stop-index="78" />
+ </value>
+ </partition-values>
+ <distributed-column name="k1" start-index="101" stop-index="102" />
+ <buckets value="20" start-index="111" stop-index="112" />
+ </add-partition>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_add_partition_with_properties_doris">
+ <table name="my_table" start-index="12" stop-index="30">
+ <owner name="example_db" start-index="12" stop-index="21" />
+ </table>
+ <add-partition start-index="32" stop-index="117">
+ <partition name="p1" start-index="46" stop-index="47" />
+ <partition-values start-index="49" stop-index="93"
type="VALUES_LESS_THAN">
+ <value>
+ <literal-expression value="2015-01-01" start-index="67"
stop-index="78" />
+ </value>
+ <value>
+ <literal-expression value="2015-01-02" start-index="81"
stop-index="92" />
+ </value>
+ </partition-values>
+ <properties start-index="96" stop-index="116">
+ <property key="replication_num" value="1" start-index="96"
stop-index="116" />
+ </properties>
+ </add-partition>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_add_partition_values_range_doris">
+ <table name="my_table" start-index="12" stop-index="30">
+ <owner name="example_db" start-index="12" stop-index="21" />
+ </table>
+ <add-partition start-index="32" stop-index="87">
+ <partition name="p1" start-index="46" stop-index="47" />
+ <partition-values start-index="49" stop-index="87"
type="VALUES_RANGE">
+ <value>
+ <literal-expression value="2014-01-01" start-index="58"
stop-index="69" />
+ </value>
+ <value>
+ <literal-expression value="2014-02-01" start-index="74"
stop-index="85" />
+ </value>
+ </partition-values>
+ </add-partition>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_add_partition_maxvalue_doris">
+ <table name="my_table" start-index="12" stop-index="30">
+ <owner name="example_db" start-index="12" stop-index="21" />
+ </table>
+ <add-partition start-index="32" stop-index="78">
+ <partition name="p_max" start-index="46" stop-index="50" />
+ <partition-values start-index="52" stop-index="78"
type="VALUES_LESS_THAN" is-max-value="true" />
+ </add-partition>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_modify_partition_single_doris">
+ <table name="my_table" start-index="12" stop-index="30">
+ <owner name="example_db" start-index="12" stop-index="21" />
+ </table>
+ <modify-partition start-index="32" stop-index="77">
+ <partition name="p1" start-index="49" stop-index="50" />
+ <properties start-index="56" stop-index="76">
+ <property key="replication_num" value="1" start-index="56"
stop-index="76" />
+ </properties>
+ </modify-partition>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_modify_partition_multiple_doris">
+ <table name="my_table" start-index="12" stop-index="30">
+ <owner name="example_db" start-index="12" stop-index="21" />
+ </table>
+ <modify-partition start-index="32" stop-index="87">
+ <partition name="p1" start-index="50" stop-index="51" />
+ <partition name="p2" start-index="54" stop-index="55" />
+ <partition name="p4" start-index="58" stop-index="59" />
+ <properties start-index="66" stop-index="86">
+ <property key="replication_num" value="1" start-index="66"
stop-index="86" />
+ </properties>
+ </modify-partition>
+ </alter-table>
+
+ <alter-table
sql-case-id="alter_table_modify_partition_storage_medium_doris">
+ <table name="my_table" start-index="12" stop-index="30">
+ <owner name="example_db" start-index="12" stop-index="21" />
+ </table>
+ <modify-partition start-index="32" stop-index="79"
all-partitions="true">
+ <properties start-index="57" stop-index="78">
+ <property key="storage_medium" value="HDD" start-index="57"
stop-index="78" />
+ </properties>
+ </modify-partition>
+ </alter-table>
+
+ <alter-table
sql-case-id="alter_table_add_partitions_from_to_interval_number_doris">
+ <table name="my_table" start-index="12" stop-index="30">
+ <owner name="example_db" start-index="12" stop-index="21" />
+ </table>
+ <add-partitions start-index="32" stop-index="75">
+ <from-value>
+ <literal-expression value="1" start-index="53" stop-index="53"
/>
+ </from-value>
+ <to-value>
+ <literal-expression value="100" start-index="60"
stop-index="62" />
+ </to-value>
+ <interval-value>
+ <literal-expression value="10" start-index="74"
stop-index="75" />
+ </interval-value>
+ </add-partitions>
+ </alter-table>
+
+ <alter-table
sql-case-id="alter_table_add_partitions_from_to_interval_year_doris">
+ <table name="my_table" start-index="12" stop-index="30">
+ <owner name="example_db" start-index="12" stop-index="21" />
+ </table>
+ <add-partitions start-index="32" stop-index="99">
+ <from-value>
+ <literal-expression value="2023-01-01" start-index="53"
stop-index="64" />
+ </from-value>
+ <to-value>
+ <literal-expression value="2025-01-01" start-index="71"
stop-index="82" />
+ </to-value>
+ <interval-value>
+ <literal-expression value="1" start-index="94" stop-index="94"
/>
+ </interval-value>
+ <interval-unit name="YEAR" start-index="96" stop-index="99" />
+ </add-partitions>
+ </alter-table>
+
+ <alter-table
sql-case-id="alter_table_add_partitions_from_to_interval_month_doris">
+ <table name="my_table" start-index="12" stop-index="30">
+ <owner name="example_db" start-index="12" stop-index="21" />
+ </table>
+ <add-partitions start-index="32" stop-index="100">
+ <from-value>
+ <literal-expression value="2023-01-01" start-index="53"
stop-index="64" />
+ </from-value>
+ <to-value>
+ <literal-expression value="2025-01-01" start-index="71"
stop-index="82" />
+ </to-value>
+ <interval-value>
+ <literal-expression value="1" start-index="94" stop-index="94"
/>
+ </interval-value>
+ <interval-unit name="MONTH" start-index="96" stop-index="100" />
+ </add-partitions>
+ </alter-table>
+
+ <alter-table
sql-case-id="alter_table_add_partitions_from_to_interval_week_doris">
+ <table name="my_table" start-index="12" stop-index="30">
+ <owner name="example_db" start-index="12" stop-index="21" />
+ </table>
+ <add-partitions start-index="32" stop-index="99">
+ <from-value>
+ <literal-expression value="2023-01-01" start-index="53"
stop-index="64" />
+ </from-value>
+ <to-value>
+ <literal-expression value="2025-01-01" start-index="71"
stop-index="82" />
+ </to-value>
+ <interval-value>
+ <literal-expression value="1" start-index="94" stop-index="94"
/>
+ </interval-value>
+ <interval-unit name="WEEK" start-index="96" stop-index="99" />
+ </add-partitions>
+ </alter-table>
+
+ <alter-table
sql-case-id="alter_table_add_partitions_from_to_interval_day_doris">
+ <table name="my_table" start-index="12" stop-index="30">
+ <owner name="example_db" start-index="12" stop-index="21" />
+ </table>
+ <add-partitions start-index="32" stop-index="98">
+ <from-value>
+ <literal-expression value="2023-01-01" start-index="53"
stop-index="64" />
+ </from-value>
+ <to-value>
+ <literal-expression value="2025-01-01" start-index="71"
stop-index="82" />
+ </to-value>
+ <interval-value>
+ <literal-expression value="1" start-index="94" stop-index="94"
/>
+ </interval-value>
+ <interval-unit name="DAY" start-index="96" stop-index="98" />
+ </add-partitions>
+ </alter-table>
</sql-parser-test-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml
b/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml
index e8bea9f12ad..1ff33c46d4b 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml
@@ -402,4 +402,16 @@
<sql-case id="alter_table_replace_with_table_swap_false" value="ALTER
TABLE tbl1 REPLACE WITH TABLE tbl2 PROPERTIES('swap' = 'false')"
db-types="Doris" />
<sql-case id="alter_table_replace_with_table_default" value="ALTER TABLE
tbl1 REPLACE WITH TABLE tbl2" db-types="Doris" />
<sql-case id="alter_table_replace_with_table_with_database" value="ALTER
TABLE db1.tbl1 REPLACE WITH TABLE db2.tbl2 PROPERTIES('swap' = 'true')"
db-types="Doris" />
+ <sql-case id="alter_table_add_partition_values_less_than_doris"
value="ALTER TABLE example_db.my_table ADD PARTITION p1 VALUES LESS THAN
("2015-01-01") DISTRIBUTED BY HASH(k1) BUCKETS 20" db-types="Doris" />
+ <sql-case id="alter_table_add_partition_with_properties_doris"
value="ALTER TABLE example_db.my_table ADD PARTITION p1 VALUES LESS THAN
("2015-01-01", "2015-01-02")
("replication_num"="1")" db-types="Doris" />
+ <sql-case id="alter_table_add_partition_values_range_doris" value="ALTER
TABLE example_db.my_table ADD PARTITION p1 VALUES [("2014-01-01"),
("2014-02-01"))" db-types="Doris" />
+ <sql-case id="alter_table_add_partition_maxvalue_doris" value="ALTER TABLE
example_db.my_table ADD PARTITION p_max VALUES LESS THAN (MAXVALUE)"
db-types="Doris" />
+ <sql-case id="alter_table_modify_partition_single_doris" value="ALTER
TABLE example_db.my_table MODIFY PARTITION p1
SET("replication_num"="1")" db-types="Doris" />
+ <sql-case id="alter_table_modify_partition_multiple_doris" value="ALTER
TABLE example_db.my_table MODIFY PARTITION (p1, p2, p4)
SET("replication_num"="1")" db-types="Doris" />
+ <sql-case id="alter_table_modify_partition_storage_medium_doris"
value="ALTER TABLE example_db.my_table MODIFY PARTITION (*)
SET("storage_medium"="HDD")" db-types="Doris" />
+ <sql-case id="alter_table_add_partitions_from_to_interval_number_doris"
value="ALTER TABLE example_db.my_table ADD PARTITIONS FROM (1) TO (100)
INTERVAL 10" db-types="Doris" />
+ <sql-case id="alter_table_add_partitions_from_to_interval_year_doris"
value="ALTER TABLE example_db.my_table ADD PARTITIONS FROM
("2023-01-01") TO ("2025-01-01") INTERVAL 1 YEAR"
db-types="Doris" />
+ <sql-case id="alter_table_add_partitions_from_to_interval_month_doris"
value="ALTER TABLE example_db.my_table ADD PARTITIONS FROM
("2023-01-01") TO ("2025-01-01") INTERVAL 1 MONTH"
db-types="Doris" />
+ <sql-case id="alter_table_add_partitions_from_to_interval_week_doris"
value="ALTER TABLE example_db.my_table ADD PARTITIONS FROM
("2023-01-01") TO ("2025-01-01") INTERVAL 1 WEEK"
db-types="Doris" />
+ <sql-case id="alter_table_add_partitions_from_to_interval_day_doris"
value="ALTER TABLE example_db.my_table ADD PARTITIONS FROM
("2023-01-01") TO ("2025-01-01") INTERVAL 1 DAY"
db-types="Doris" />
</sql-cases>