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 413ba5e4edd Support for the ALTER STORAGE POLICY statement and the
ALTER TABLE RENAME statement (#37537)
413ba5e4edd is described below
commit 413ba5e4eddbdc11dfb7a2b8faf8b19030edb432
Author: cxy <[email protected]>
AuthorDate: Sat Dec 27 01:29:08 2025 +0800
Support for the ALTER STORAGE POLICY statement and the ALTER TABLE RENAME
statement (#37537)
* Support for the ALTER STORAGE POLICY statement and the ALTER TABLE RENAME
statement
* Support for the ALTER STORAGE POLICY statement and the ALTER TABLE RENAME
statement
---
.../core/database/visitor/SQLVisitorRule.java | 2 +
.../src/main/antlr4/imports/doris/BaseRule.g4 | 1 +
.../src/main/antlr4/imports/doris/DDLStatement.g4 | 9 ++-
.../src/main/antlr4/imports/doris/DorisKeyword.g4 | 4 ++
.../statement/type/DorisDDLStatementVisitor.java | 63 ++++++++++++++++
.../RenamePartitionDefinitionSegment.java | 28 ++++----
.../core/segment/ddl/policy/PolicyNameSegment.java | 35 +++++----
.../segment/ddl/property/PropertiesSegment.java | 71 ++++++++++++++++++
.../core/segment/ddl/property/PropertySegment.java | 27 ++++---
.../ddl/rollup/RenameRollupDefinitionSegment.java | 27 ++++---
.../core/segment/ddl/rollup/RollupSegment.java | 26 ++++---
.../type/ddl/table/AlterTableStatement.java | 6 ++
.../ddl/DorisAlterStoragePolicyStatement.java | 41 +++++++++++
.../asserts/segment/partition/PartitionAssert.java | 47 ++++++++++++
.../asserts/segment/policy/PolicyAssert.java | 72 +++++++++++++++++++
.../asserts/segment/rollup/RollupAssert.java | 47 ++++++++++++
.../ddl/dialect/doris/DorisDDLStatementAssert.java | 5 ++
.../DorisAlterStoragePolicyStatementAssert.java | 56 +++++++++++++++
.../standard/type/AlterTableStatementAssert.java | 32 +++++++++
.../cases/parser/jaxb/RootSQLParserTestCases.java | 4 ++
.../impl/catalog/ExpectedCatalogProperties.java | 3 +-
.../ExpectedRenamePartitionDefinition.java} | 20 +++---
.../ExpectedRenameRollupDefinition.java} | 20 +++---
.../ExpectedPolicyName.java} | 13 ++--
.../ExpectedRollup.java} | 21 ++----
.../DorisAlterStoragePolicyStatementTestCase.java} | 18 +++--
.../table/AlterTableStatementTestCase.java | 8 +++
.../resources/case/ddl/alter-storage-policy.xml | 84 ++++++++++++++++++++++
.../src/main/resources/case/ddl/alter-table.xml | 29 ++++++++
.../sql/supported/ddl/alter-storage-policy.xml | 29 ++++++++
.../resources/sql/supported/ddl/alter-table.xml | 4 ++
31 files changed, 727 insertions(+), 125 deletions(-)
diff --git
a/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java
b/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java
index 410a2611d7d..bbcf93ca83f 100644
---
a/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java
+++
b/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java
@@ -187,6 +187,8 @@ public enum SQLVisitorRule {
ALTER_SYSTEM("AlterSystem", SQLStatementType.DDL),
+ ALTER_STORAGE_POLICY("AlterStoragePolicy", SQLStatementType.DDL),
+
DROP_SERVER("DropServer", SQLStatementType.DDL),
CREATE_TRIGGER("CreateTrigger", SQLStatementType.DDL),
diff --git
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/BaseRule.g4
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/BaseRule.g4
index 80438878762..db3f58255bf 100644
--- a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/BaseRule.g4
+++ b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/BaseRule.g4
@@ -398,6 +398,7 @@ identifierKeywordsUnambiguous
| PROCESSLIST
| PROFILES
| PROFILE
+ | POLICY
| QUARTER
| QUERY
| QUICK
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 c1fbec21d4d..260df85b675 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
@@ -30,6 +30,7 @@ alterStatement
| alterInstance
| alterServer
| alterCatalog
+ | alterStoragePolicy
;
createTable
@@ -133,9 +134,11 @@ alterListItem
| ALTER INDEX indexName visibility # alterIndex
| ALTER CHECK constraintName constraintEnforcement # alterCheck
| ALTER CONSTRAINT constraintName constraintEnforcement # alterConstraint
- | RENAME COLUMN oldColumn TO newColumn # renameColumn
+ | RENAME COLUMN oldColumn TO? newColumn # renameColumn
| RENAME (TO | AS)? tableName # alterRenameTable
| RENAME keyOrIndex indexName TO indexName # renameIndex
+ | RENAME ROLLUP oldRollupName=identifier newRollupName=identifier #
renameRollup
+ | RENAME PARTITION oldPartitionName=identifier newPartitionName=identifier
# renamePartition
| CONVERT TO charset charsetName collateClause? # alterConvert
| FORCE # alterTableForce
| ORDER BY alterOrderList # alterTableOrder
@@ -145,6 +148,10 @@ alterOrderList
: columnRef direction? (COMMA_ columnRef direction?)*
;
+alterStoragePolicy
+ : ALTER STORAGE POLICY identifier propertiesClause
+ ;
+
tableConstraintDef
: keyOrIndex indexName? indexTypeClause? keyListWithExpression indexOption*
| FULLTEXT keyOrIndex? indexName? keyListWithExpression
fulltextIndexOption*
diff --git
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4
index e84be24132e..d5ba02b561b 100644
---
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4
+++
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4
@@ -2016,6 +2016,10 @@ PARAMETER
: P A R A M E T E R
;
+POLICY
+ : P O L I C Y
+ ;
+
QUARTER
: Q U A R T E R
;
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 15d751510ba..a0a457b06f8 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
@@ -112,9 +112,14 @@ import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.TableNa
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.RenameRollupContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RenamePartitionContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterStoragePolicyContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertiesClauseContext;
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;
+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.CreateDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.charset.CharsetNameSegment;
@@ -137,6 +142,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.RenamePartitionDefinitionSegment;
+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;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.rollup.RenameRollupDefinitionSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.rollup.RollupSegment;
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;
@@ -193,6 +204,7 @@ import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.Up
import org.apache.shardingsphere.sql.parser.statement.core.util.SQLUtils;
import
org.apache.shardingsphere.sql.parser.statement.core.value.collection.CollectionValue;
import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
+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.DorisResumeJobStatement;
import
org.apache.shardingsphere.sql.parser.statement.mysql.ddl.event.MySQLAlterEventStatement;
@@ -388,6 +400,10 @@ public final class DorisDDLStatementVisitor extends
DorisStatementVisitor implem
alterTableStatement.getRenameIndexDefinitions().add((RenameIndexDefinitionSegment)
alterDefinitionSegment);
} else if (alterDefinitionSegment instanceof RenameColumnSegment) {
alterTableStatement.getRenameColumnDefinitions().add((RenameColumnSegment)
alterDefinitionSegment);
+ } else if (alterDefinitionSegment instanceof
RenameRollupDefinitionSegment) {
+
alterTableStatement.getRenameRollupDefinitions().add((RenameRollupDefinitionSegment)
alterDefinitionSegment);
+ } else if (alterDefinitionSegment instanceof
RenamePartitionDefinitionSegment) {
+
alterTableStatement.getRenamePartitionDefinitions().add((RenamePartitionDefinitionSegment)
alterDefinitionSegment);
} else if (alterDefinitionSegment instanceof AlgorithmTypeSegment) {
alterTableStatement.setAlgorithmSegment((AlgorithmTypeSegment)
alterDefinitionSegment);
} else if (alterDefinitionSegment instanceof LockTableSegment) {
@@ -470,6 +486,12 @@ public final class DorisDDLStatementVisitor extends
DorisStatementVisitor implem
if (alterListItemContext instanceof RenameIndexContext) {
return Optional.of((RenameIndexDefinitionSegment)
visit(alterListItemContext));
}
+ if (alterListItemContext instanceof RenameRollupContext) {
+ return Optional.of((RenameRollupDefinitionSegment)
visit(alterListItemContext));
+ }
+ if (alterListItemContext instanceof RenamePartitionContext) {
+ return Optional.of((RenamePartitionDefinitionSegment)
visit(alterListItemContext));
+ }
return Optional.empty();
}
@@ -757,6 +779,47 @@ public final class DorisDDLStatementVisitor extends
DorisStatementVisitor implem
return new RenameIndexDefinitionSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), indexNameSegment, renameIndexName);
}
+ @Override
+ public ASTNode visitRenameRollup(final RenameRollupContext ctx) {
+ RollupSegment oldRollupSegment = new
RollupSegment(ctx.oldRollupName.getStart().getStartIndex(),
ctx.oldRollupName.getStop().getStopIndex(),
+ (IdentifierValue) visit(ctx.oldRollupName));
+ RollupSegment newRollupSegment = new
RollupSegment(ctx.newRollupName.getStart().getStartIndex(),
ctx.newRollupName.getStop().getStopIndex(),
+ (IdentifierValue) visit(ctx.newRollupName));
+ return new RenameRollupDefinitionSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), oldRollupSegment, newRollupSegment);
+ }
+
+ @Override
+ public ASTNode visitRenamePartition(final RenamePartitionContext ctx) {
+ PartitionSegment oldPartitionSegment = new
PartitionSegment(ctx.oldPartitionName.getStart().getStartIndex(),
ctx.oldPartitionName.getStop().getStopIndex(),
+ (IdentifierValue) visit(ctx.oldPartitionName));
+ PartitionSegment newPartitionSegment = new
PartitionSegment(ctx.newPartitionName.getStart().getStartIndex(),
ctx.newPartitionName.getStop().getStopIndex(),
+ (IdentifierValue) visit(ctx.newPartitionName));
+ return new RenamePartitionDefinitionSegment(ctx.start.getStartIndex(),
ctx.stop.getStopIndex(), oldPartitionSegment, newPartitionSegment);
+ }
+
+ @Override
+ public ASTNode visitAlterStoragePolicy(final AlterStoragePolicyContext
ctx) {
+ IdentifierValue identifier = (IdentifierValue) visit(ctx.identifier());
+ PolicyNameSegment policyNameSegment = new
PolicyNameSegment(ctx.identifier().getStart().getStartIndex(),
ctx.identifier().getStop().getStopIndex(), identifier);
+ PropertiesSegment propertiesSegment =
extractPropertiesSegment(ctx.propertiesClause());
+ return new DorisAlterStoragePolicyStatement(getDatabaseType(),
policyNameSegment, propertiesSegment);
+ }
+
+ private PropertiesSegment extractPropertiesSegment(final
PropertiesClauseContext ctx) {
+ PropertiesSegment result = new
PropertiesSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex());
+ for (PropertyContext each : ctx.properties().property()) {
+ String key = getPropertyKey(each);
+ String value = getPropertyValue(each);
+ PropertySegment propertySegment = new
PropertySegment(each.getStart().getStartIndex(), each.getStop().getStopIndex(),
key, value);
+ result.getProperties().add(propertySegment);
+ }
+ return result;
+ }
+
+ private String getPropertyValue(final PropertyContext ctx) {
+ return SQLUtils.getExactlyValue(ctx.literals().getText());
+ }
+
@Override
public ASTNode visitKeyParts(final KeyPartsContext ctx) {
CollectionValue<ColumnSegment> result = new CollectionValue<>();
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/RenamePartitionDefinitionSegment.java
similarity index 56%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
copy to
parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/RenamePartitionDefinitionSegment.java
index 34e13910ab4..4df03432dbd 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/partition/RenamePartitionDefinitionSegment.java
@@ -15,25 +15,25 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.catalog;
+package
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.partition;
import lombok.Getter;
-import lombok.Setter;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
+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;
/**
- * Expected catalog properties.
+ * Rename partition definition segment.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
+@RequiredArgsConstructor
@Getter
-@Setter
-public final class ExpectedCatalogProperties {
+public final class RenamePartitionDefinitionSegment implements
AlterDefinitionSegment {
+
+ private final int startIndex;
+
+ private final int stopIndex;
+
+ private final PartitionSegment partitionSegment;
- @XmlElement(name = "property")
- private final List<ExpectedCatalogProperty> properties = new
LinkedList<>();
+ private final PartitionSegment renamePartitionSegment;
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/policy/PolicyNameSegment.java
similarity index 55%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
copy to
parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/policy/PolicyNameSegment.java
index 34e13910ab4..41f4c52750d 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/policy/PolicyNameSegment.java
@@ -15,25 +15,32 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.catalog;
+package org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.policy;
import lombok.Getter;
-import lombok.Setter;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.sql.parser.statement.core.segment.SQLSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
/**
- * Expected catalog properties.
+ * Policy name segment.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
+@RequiredArgsConstructor
@Getter
-@Setter
-public final class ExpectedCatalogProperties {
+public final class PolicyNameSegment implements SQLSegment {
+
+ private final int startIndex;
+
+ private final int stopIndex;
+
+ private final IdentifierValue identifier;
- @XmlElement(name = "property")
- private final List<ExpectedCatalogProperty> properties = new
LinkedList<>();
+ /**
+ * Get policy name.
+ *
+ * @return policy name
+ */
+ public String getName() {
+ return identifier.getValue();
+ }
}
diff --git
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/property/PropertiesSegment.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/property/PropertiesSegment.java
new file mode 100644
index 00000000000..55e105135ef
--- /dev/null
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/property/PropertiesSegment.java
@@ -0,0 +1,71 @@
+/*
+ * 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.property;
+
+import lombok.Getter;
+import org.apache.shardingsphere.sql.parser.statement.core.segment.SQLSegment;
+
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Properties segment.
+ */
+@Getter
+public final class PropertiesSegment implements SQLSegment {
+
+ private final int startIndex;
+
+ private final int stopIndex;
+
+ private final List<PropertySegment> properties = new LinkedList<>();
+
+ public PropertiesSegment(final int startIndex, final int stopIndex) {
+ this.startIndex = startIndex;
+ this.stopIndex = stopIndex;
+ }
+
+ /**
+ * Convert to properties map.
+ *
+ * @return properties map
+ */
+ public Properties toProperties() {
+ Properties result = new Properties();
+ for (PropertySegment each : properties) {
+ result.setProperty(each.getKey(), each.getValue());
+ }
+ return result;
+ }
+
+ /**
+ * Convert to map.
+ *
+ * @return map
+ */
+ public Map<String, String> toMap() {
+ Map<String, String> result = new LinkedHashMap<>();
+ for (PropertySegment each : properties) {
+ result.put(each.getKey(), each.getValue());
+ }
+ return result;
+ }
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/property/PropertySegment.java
similarity index 60%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
copy to
parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/property/PropertySegment.java
index 34e13910ab4..24f0e90f1ad 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/property/PropertySegment.java
@@ -15,25 +15,24 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.catalog;
+package
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.property;
import lombok.Getter;
-import lombok.Setter;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.sql.parser.statement.core.segment.SQLSegment;
/**
- * Expected catalog properties.
+ * Property segment.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
+@RequiredArgsConstructor
@Getter
-@Setter
-public final class ExpectedCatalogProperties {
+public final class PropertySegment implements SQLSegment {
+
+ private final int startIndex;
+
+ private final int stopIndex;
+
+ private final String key;
- @XmlElement(name = "property")
- private final List<ExpectedCatalogProperty> properties = new
LinkedList<>();
+ private final String value;
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/rollup/RenameRollupDefinitionSegment.java
similarity index 60%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
copy to
parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/rollup/RenameRollupDefinitionSegment.java
index 34e13910ab4..151b041498c 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/rollup/RenameRollupDefinitionSegment.java
@@ -15,25 +15,24 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.catalog;
+package org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.rollup;
import lombok.Getter;
-import lombok.Setter;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
+import lombok.RequiredArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.AlterDefinitionSegment;
/**
- * Expected catalog properties.
+ * Rename rollup definition segment.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
+@RequiredArgsConstructor
@Getter
-@Setter
-public final class ExpectedCatalogProperties {
+public final class RenameRollupDefinitionSegment implements
AlterDefinitionSegment {
+
+ private final int startIndex;
+
+ private final int stopIndex;
+
+ private final RollupSegment rollupSegment;
- @XmlElement(name = "property")
- private final List<ExpectedCatalogProperty> properties = new
LinkedList<>();
+ private final RollupSegment renameRollupSegment;
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/rollup/RollupSegment.java
similarity index 60%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
copy to
parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/rollup/RollupSegment.java
index 34e13910ab4..cfc0470ca99 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/rollup/RollupSegment.java
@@ -15,25 +15,23 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.catalog;
+package org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.rollup;
import lombok.Getter;
-import lombok.Setter;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.sql.parser.statement.core.segment.SQLSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
/**
- * Expected catalog properties.
+ * Rollup segment.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
+@RequiredArgsConstructor
@Getter
-@Setter
-public final class ExpectedCatalogProperties {
+public final class RollupSegment implements SQLSegment {
+
+ private final int startIndex;
+
+ private final int stopIndex;
- @XmlElement(name = "property")
- private final List<ExpectedCatalogProperty> properties = new
LinkedList<>();
+ private final IdentifierValue name;
}
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 6628275bd32..7b2b4d80e61 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,7 +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.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;
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.LockTableSegment;
@@ -98,6 +100,10 @@ public final class AlterTableStatement extends DDLStatement
{
private final Collection<ReplaceColumnDefinitionSegment>
replaceColumnDefinitions = new LinkedList<>();
+ private final Collection<RenameRollupDefinitionSegment>
renameRollupDefinitions = new LinkedList<>();
+
+ private final Collection<RenamePartitionDefinitionSegment>
renamePartitionDefinitions = new LinkedList<>();
+
public AlterTableStatement(final DatabaseType databaseType) {
super(databaseType);
}
diff --git
a/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/ddl/DorisAlterStoragePolicyStatement.java
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/ddl/DorisAlterStoragePolicyStatement.java
new file mode 100644
index 00000000000..d8da3436b67
--- /dev/null
+++
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/ddl/DorisAlterStoragePolicyStatement.java
@@ -0,0 +1,41 @@
+/*
+ * 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.doris.ddl;
+
+import lombok.Getter;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+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.statement.type.ddl.DDLStatement;
+
+/**
+ * Alter storage policy statement for Doris.
+ */
+@Getter
+public final class DorisAlterStoragePolicyStatement extends DDLStatement {
+
+ private final PolicyNameSegment policyName;
+
+ private final PropertiesSegment properties;
+
+ public DorisAlterStoragePolicyStatement(final DatabaseType databaseType,
final PolicyNameSegment policyName, final PropertiesSegment properties) {
+ super(databaseType);
+ this.policyName = policyName;
+ this.properties = properties;
+ }
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/partition/PartitionAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/partition/PartitionAssert.java
new file mode 100644
index 00000000000..27931cd4e83
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/partition/PartitionAssert.java
@@ -0,0 +1,47 @@
+/*
+ * 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.asserts.segment.partition;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dal.PartitionSegment;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQLSegmentAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.index.ExpectedPartition;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+/**
+ * Partition assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class PartitionAssert {
+
+ /**
+ * Assert actual partition segment is correct with expected partition.
+ *
+ * @param assertContext assert context
+ * @param actual actual partition segment
+ * @param expected expected partition
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final PartitionSegment actual, final ExpectedPartition expected) {
+ assertThat(assertContext.getText("Partition name assertion error: "),
actual.getName().getValue(), is(expected.getName()));
+ SQLSegmentAssert.assertIs(assertContext, actual, expected);
+ }
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/policy/PolicyAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/policy/PolicyAssert.java
new file mode 100644
index 00000000000..07bf38741c7
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/policy/PolicyAssert.java
@@ -0,0 +1,72 @@
+/*
+ * 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.asserts.segment.policy;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+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;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQLSegmentAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.catalog.ExpectedCatalogProperties;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.catalog.ExpectedCatalogProperty;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.policy.ExpectedPolicyName;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+/**
+ * Policy assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class PolicyAssert {
+
+ /**
+ * Assert policy name is correct with expected policy name.
+ *
+ * @param assertContext assert context
+ * @param actual actual policy name segment
+ * @param expected expected policy name
+ */
+ public static void assertPolicyName(final SQLCaseAssertContext
assertContext, final PolicyNameSegment actual, final ExpectedPolicyName
expected) {
+ assertThat(assertContext.getText("Policy name assertion error: "),
actual.getName(), is(expected.getName()));
+ SQLSegmentAssert.assertIs(assertContext, actual, expected);
+ }
+
+ /**
+ * Assert properties are correct with expected properties.
+ *
+ * @param assertContext assert context
+ * @param actual actual properties segment
+ * @param expected expected properties
+ */
+ public static void assertProperties(final SQLCaseAssertContext
assertContext, final PropertiesSegment actual, final ExpectedCatalogProperties
expected) {
+ SQLSegmentAssert.assertIs(assertContext, actual, expected);
+ assertThat(assertContext.getText("Properties size assertion error: "),
actual.getProperties().size(), is(expected.getProperties().size()));
+ for (int i = 0; i < expected.getProperties().size(); i++) {
+ assertProperty(assertContext, actual.getProperties().get(i),
expected.getProperties().get(i));
+ }
+ }
+
+ private static void assertProperty(final SQLCaseAssertContext
assertContext, final PropertySegment actual, final ExpectedCatalogProperty
expected) {
+ assertThat(assertContext.getText(String.format("Property key '%s'
assertion error: ", expected.getKey())), actual.getKey(),
is(expected.getKey()));
+ assertThat(assertContext.getText(String.format("Property value for key
'%s' assertion error: ", expected.getKey())), actual.getValue(),
is(expected.getValue()));
+ SQLSegmentAssert.assertIs(assertContext, actual, expected);
+ }
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/rollup/RollupAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/rollup/RollupAssert.java
new file mode 100644
index 00000000000..cc123a1b596
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/rollup/RollupAssert.java
@@ -0,0 +1,47 @@
+/*
+ * 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.asserts.segment.rollup;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.rollup.RollupSegment;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQLSegmentAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.rollup.ExpectedRollup;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+/**
+ * Rollup assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class RollupAssert {
+
+ /**
+ * Assert actual rollup segment is correct with expected rollup.
+ *
+ * @param assertContext assert context
+ * @param actual actual rollup segment
+ * @param expected expected rollup
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final RollupSegment actual, final ExpectedRollup expected) {
+ assertThat(assertContext.getText("Rollup name assertion error: "),
actual.getName().getValue(), is(expected.getName()));
+ SQLSegmentAssert.assertIs(assertContext, actual, expected);
+ }
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisDDLStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisDDLStatementAssert.java
index 7a55da69cc5..db673cd7a5c 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisDDLStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/DorisDDLStatementAssert.java
@@ -20,10 +20,13 @@ 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.statement.type.ddl.DDLStatement;
+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.DorisResumeJobStatement;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ddl.dialect.doris.type.DorisAlterStoragePolicyStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisAlterStoragePolicyStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisResumeJobStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.standard.function.CreateFunctionStatementTestCase;
@@ -45,6 +48,8 @@ public final class DorisDDLStatementAssert {
DorisResumeJobStatementAssert.assertIs(assertContext,
(DorisResumeJobStatement) actual, (DorisResumeJobStatementTestCase) expected);
} else if (actual instanceof DorisCreateFunctionStatement) {
DorisCreateFunctionStatementAssert.assertIs(assertContext,
(DorisCreateFunctionStatement) actual, (CreateFunctionStatementTestCase)
expected);
+ } else if (actual instanceof DorisAlterStoragePolicyStatement) {
+ DorisAlterStoragePolicyStatementAssert.assertIs(assertContext,
(DorisAlterStoragePolicyStatement) actual,
(DorisAlterStoragePolicyStatementTestCase) expected);
}
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/type/DorisAlterStoragePolicyStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/type/DorisAlterStoragePolicyStatementAssert.java
new file mode 100644
index 00000000000..17b4f6f5a8f
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/type/DorisAlterStoragePolicyStatementAssert.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.test.it.sql.parser.internal.asserts.statement.ddl.dialect.doris.type;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisAlterStoragePolicyStatement;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.policy.PolicyAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisAlterStoragePolicyStatementTestCase;
+
+/**
+ * Alter storage policy statement assert for Doris.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DorisAlterStoragePolicyStatementAssert {
+
+ /**
+ * Assert alter storage policy statement is correct with expected parser
result.
+ *
+ * @param assertContext assert context
+ * @param actual actual alter storage policy statement
+ * @param expected expected alter storage policy statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final DorisAlterStoragePolicyStatement actual, final
DorisAlterStoragePolicyStatementTestCase expected) {
+ assertPolicyName(assertContext, actual, expected);
+ assertProperties(assertContext, actual, expected);
+ }
+
+ private static void assertPolicyName(final SQLCaseAssertContext
assertContext, final DorisAlterStoragePolicyStatement actual, final
DorisAlterStoragePolicyStatementTestCase expected) {
+ if (null != expected.getPolicyName()) {
+ PolicyAssert.assertPolicyName(assertContext,
actual.getPolicyName(), expected.getPolicyName());
+ }
+ }
+
+ private static void assertProperties(final SQLCaseAssertContext
assertContext, final DorisAlterStoragePolicyStatement actual, final
DorisAlterStoragePolicyStatementTestCase expected) {
+ if (null != expected.getProperties()) {
+ PolicyAssert.assertProperties(assertContext,
actual.getProperties(), expected.getProperties());
+ }
+ }
+}
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 a482492547a..21b621b4250 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
@@ -29,7 +29,9 @@ 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.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;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.ConvertTableDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
@@ -43,6 +45,8 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.def
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.definition.ConstraintDefinitionAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.definition.IndexDefinitionAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.expression.ExpressionAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.partition.PartitionAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.rollup.RollupAssert;
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.segment.impl.definition.ExpectedAddColumnDefinition;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.definition.ExpectedChangeColumnDefinition;
@@ -51,6 +55,8 @@ 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.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.statement.ddl.standard.table.AlterTableStatementTestCase;
import java.util.Collection;
@@ -89,6 +95,8 @@ public final class AlterTableStatementAssert {
assertDropColumns(assertContext, actual, expected);
assertRenameIndexDefinitions(assertContext, actual, expected);
assertRenameColumnDefinitions(assertContext, actual, expected);
+ assertRenameRollupDefinitions(assertContext, actual, expected);
+ assertRenamePartitionDefinitions(assertContext, actual, expected);
assertConvertTable(assertContext, actual, expected);
assertModifyCollectionRetrievalDefinitions(assertContext, actual,
expected);
assertDropPrimaryKeyDefinition(assertContext, actual, expected);
@@ -247,6 +255,30 @@ public final class AlterTableStatementAssert {
}
}
+ private static void assertRenameRollupDefinitions(final
SQLCaseAssertContext assertContext, final AlterTableStatement actual, final
AlterTableStatementTestCase expected) {
+ assertThat(assertContext.getText("Rename rollup definitions size
assertion error: "), actual.getRenameRollupDefinitions().size(),
is(expected.getRenameRollups().size()));
+ int count = 0;
+ for (RenameRollupDefinitionSegment each :
actual.getRenameRollupDefinitions()) {
+ ExpectedRenameRollupDefinition expectedRenameRollupDefinition =
expected.getRenameRollups().get(count);
+ RollupAssert.assertIs(assertContext, each.getRollupSegment(),
expectedRenameRollupDefinition.getOldRollup());
+ RollupAssert.assertIs(assertContext,
each.getRenameRollupSegment(), expectedRenameRollupDefinition.getNewRollup());
+ SQLSegmentAssert.assertIs(assertContext, each,
expectedRenameRollupDefinition);
+ count++;
+ }
+ }
+
+ private static void assertRenamePartitionDefinitions(final
SQLCaseAssertContext assertContext, final AlterTableStatement actual, final
AlterTableStatementTestCase expected) {
+ assertThat(assertContext.getText("Rename partition definitions size
assertion error: "), actual.getRenamePartitionDefinitions().size(),
is(expected.getRenamePartitions().size()));
+ int count = 0;
+ for (RenamePartitionDefinitionSegment each :
actual.getRenamePartitionDefinitions()) {
+ ExpectedRenamePartitionDefinition
expectedRenamePartitionDefinition = expected.getRenamePartitions().get(count);
+ PartitionAssert.assertIs(assertContext,
each.getPartitionSegment(),
expectedRenamePartitionDefinition.getOldPartition());
+ PartitionAssert.assertIs(assertContext,
each.getRenamePartitionSegment(),
expectedRenamePartitionDefinition.getNewPartition());
+ SQLSegmentAssert.assertIs(assertContext, each,
expectedRenamePartitionDefinition);
+ 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/RootSQLParserTestCases.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
index 5bb77e0b25b..d5534219f0f 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
@@ -21,6 +21,7 @@ import com.google.common.base.Preconditions;
import lombok.Getter;
import lombok.SneakyThrows;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.CommonStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisAlterStoragePolicyStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisResumeJobStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.standard.catalog.AlterCatalogStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.tcl.HiveAbortStatementTestCase;
@@ -757,6 +758,9 @@ public final class RootSQLParserTestCases {
@XmlElement(name = "alter-package")
private final List<AlterPackageStatementTestCase> alterPackageTestCases =
new LinkedList<>();
+ @XmlElement(name = "alter-storage-policy")
+ private final List<DorisAlterStoragePolicyStatementTestCase>
alterStoragePolicyTestCases = new LinkedList<>();
+
@XmlElement(name = "drop-package")
private final List<OracleDropPackageStatementTestCase>
dropPackageTestCases = new LinkedList<>();
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
index 34e13910ab4..46fa92d82ed 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
@@ -19,6 +19,7 @@ package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.
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.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -32,7 +33,7 @@ import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
-public final class ExpectedCatalogProperties {
+public final class ExpectedCatalogProperties extends
AbstractExpectedSQLSegment {
@XmlElement(name = "property")
private final List<ExpectedCatalogProperty> properties = new
LinkedList<>();
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/definition/ExpectedRenamePartitionDefinition.java
similarity index 63%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
copy to
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/definition/ExpectedRenamePartitionDefinition.java
index 34e13910ab4..9e0096e55b4 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/definition/ExpectedRenamePartitionDefinition.java
@@ -15,25 +15,25 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.catalog;
+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 javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
/**
- * Expected catalog properties.
+ * Expected rename partition definition.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
-public final class ExpectedCatalogProperties {
+public final class ExpectedRenamePartitionDefinition extends
AbstractExpectedSQLSegment {
- @XmlElement(name = "property")
- private final List<ExpectedCatalogProperty> properties = new
LinkedList<>();
+ @XmlElement(name = "old-partition")
+ private ExpectedPartition oldPartition;
+
+ @XmlElement(name = "new-partition")
+ private ExpectedPartition newPartition;
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/definition/ExpectedRenameRollupDefinition.java
similarity index 64%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
copy to
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/definition/ExpectedRenameRollupDefinition.java
index 34e13910ab4..a386fce2d89 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/definition/ExpectedRenameRollupDefinition.java
@@ -15,25 +15,25 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.catalog;
+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.rollup.ExpectedRollup;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
/**
- * Expected catalog properties.
+ * Expected rename rollup definition.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
-public final class ExpectedCatalogProperties {
+public final class ExpectedRenameRollupDefinition extends
AbstractExpectedSQLSegment {
- @XmlElement(name = "property")
- private final List<ExpectedCatalogProperty> properties = new
LinkedList<>();
+ @XmlElement(name = "old-rollup")
+ private ExpectedRollup oldRollup;
+
+ @XmlElement(name = "new-rollup")
+ private ExpectedRollup newRollup;
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/policy/ExpectedPolicyName.java
similarity index 76%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
copy to
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/policy/ExpectedPolicyName.java
index 34e13910ab4..c0c3877a3ae 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/policy/ExpectedPolicyName.java
@@ -15,25 +15,20 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.catalog;
+package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.policy;
import lombok.Getter;
import lombok.Setter;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.AbstractExpectedIdentifierSQLSegment;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
/**
- * Expected catalog properties.
+ * Expected policy name.
*/
@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
-public final class ExpectedCatalogProperties {
-
- @XmlElement(name = "property")
- private final List<ExpectedCatalogProperty> properties = new
LinkedList<>();
+public final class ExpectedPolicyName extends
AbstractExpectedIdentifierSQLSegment {
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/rollup/ExpectedRollup.java
similarity index 62%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
copy to
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/rollup/ExpectedRollup.java
index 34e13910ab4..514bdcadbba 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/rollup/ExpectedRollup.java
@@ -15,25 +15,12 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.catalog;
+package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.rollup;
-import lombok.Getter;
-import lombok.Setter;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.AbstractExpectedIdentifierSQLSegment;
/**
- * Expected catalog properties.
+ * Expected rollup.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
-@Getter
-@Setter
-public final class ExpectedCatalogProperties {
-
- @XmlElement(name = "property")
- private final List<ExpectedCatalogProperty> properties = new
LinkedList<>();
+public final class ExpectedRollup extends AbstractExpectedIdentifierSQLSegment
{
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/dialect/doris/DorisAlterStoragePolicyStatementTestCase.java
similarity index 61%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
copy to
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/dialect/doris/DorisAlterStoragePolicyStatementTestCase.java
index 34e13910ab4..691fdaa60c4 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/catalog/ExpectedCatalogProperties.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/dialect/doris/DorisAlterStoragePolicyStatementTestCase.java
@@ -15,25 +15,29 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.catalog;
+package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris;
import lombok.Getter;
import lombok.Setter;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.catalog.ExpectedCatalogProperties;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.policy.ExpectedPolicyName;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
/**
- * Expected catalog properties.
+ * Alter storage policy statement test case for Doris.
*/
@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
-public final class ExpectedCatalogProperties {
+public final class DorisAlterStoragePolicyStatementTestCase extends
SQLParserTestCase {
- @XmlElement(name = "property")
- private final List<ExpectedCatalogProperty> properties = new
LinkedList<>();
+ @XmlElement(name = "policy-name")
+ private ExpectedPolicyName policyName;
+
+ @XmlElement(name = "properties")
+ private ExpectedCatalogProperties properties;
}
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 4d06a83d776..0532b39baa6 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
@@ -30,6 +30,8 @@ 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.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.table.ExpectedSimpleTable;
import javax.xml.bind.annotation.XmlElement;
@@ -73,6 +75,12 @@ public final class AlterTableStatementTestCase extends
SQLParserTestCase {
@XmlElement(name = "rename-column")
private final List<ExpectedRenameColumnDefinition> renameColumns = new
LinkedList<>();
+ @XmlElement(name = "rename-rollup")
+ private final List<ExpectedRenameRollupDefinition> renameRollups = new
LinkedList<>();
+
+ @XmlElement(name = "rename-partition")
+ private final List<ExpectedRenamePartitionDefinition> renamePartitions =
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-storage-policy.xml
b/test/it/parser/src/main/resources/case/ddl/alter-storage-policy.xml
new file mode 100644
index 00000000000..a85bb34ab8d
--- /dev/null
+++ b/test/it/parser/src/main/resources/case/ddl/alter-storage-policy.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<sql-parser-test-cases>
+ <alter-storage-policy
sql-case-id="alter_storage_policy_with_cooldown_datetime">
+ <policy-name name="test_policy" start-index="21" stop-index="31" />
+ <properties start-index="33" stop-index="87">
+ <property key="cooldown_datetime" value="2023-06-08 00:00:00"
start-index="44" stop-index="86" />
+ </properties>
+ </alter-storage-policy>
+
+ <alter-storage-policy
sql-case-id="alter_storage_policy_with_cooldown_ttl_number">
+ <policy-name name="test_policy" start-index="21" stop-index="31" />
+ <properties start-index="33" stop-index="68">
+ <property key="cooldown_ttl" value="10000" start-index="44"
stop-index="67" />
+ </properties>
+ </alter-storage-policy>
+
+ <alter-storage-policy
sql-case-id="alter_storage_policy_with_cooldown_ttl_hours">
+ <policy-name name="test_policy" start-index="21" stop-index="31" />
+ <properties start-index="33" stop-index="65">
+ <property key="cooldown_ttl" value="1h" start-index="44"
stop-index="64" />
+ </properties>
+ </alter-storage-policy>
+
+ <alter-storage-policy
sql-case-id="alter_storage_policy_with_cooldown_ttl_days">
+ <policy-name name="test_policy" start-index="21" stop-index="31" />
+ <properties start-index="33" stop-index="65">
+ <property key="cooldown_ttl" value="3d" start-index="44"
stop-index="64" />
+ </properties>
+ </alter-storage-policy>
+
+ <alter-storage-policy
sql-case-id="alter_storage_policy_with_retention_days">
+ <policy-name name="prod_policy" start-index="21" stop-index="31" />
+ <properties start-index="33" stop-index="67">
+ <property key="retention_days" value="30" start-index="44"
stop-index="66" />
+ </properties>
+ </alter-storage-policy>
+
+ <alter-storage-policy
sql-case-id="alter_storage_policy_with_redundancy_level">
+ <policy-name name="backup_policy" start-index="21" stop-index="33" />
+ <properties start-index="35" stop-index="70">
+ <property key="redundancy_level" value="2" start-index="46"
stop-index="69" />
+ </properties>
+ </alter-storage-policy>
+
+ <alter-storage-policy sql-case-id="alter_storage_policy_with_storage_type">
+ <policy-name name="archive_policy" start-index="21" stop-index="34" />
+ <properties start-index="36" stop-index="68">
+ <property key="storage_type" value="S3" start-index="47"
stop-index="67" />
+ </properties>
+ </alter-storage-policy>
+
+ <alter-storage-policy
sql-case-id="alter_storage_policy_with_location_policy">
+ <policy-name name="geo_policy" start-index="21" stop-index="30" />
+ <properties start-index="32" stop-index="72">
+ <property key="location_policy" value="us-west" start-index="43"
stop-index="71" />
+ </properties>
+ </alter-storage-policy>
+
+ <alter-storage-policy
sql-case-id="alter_storage_policy_with_multiple_properties">
+ <policy-name name="comprehensive_policy" start-index="21"
stop-index="40" />
+ <properties start-index="42" stop-index="125">
+ <property key="cooldown_ttl" value="7d" start-index="53"
stop-index="73" />
+ <property key="retention_days" value="90" start-index="76"
stop-index="98" />
+ <property key="redundancy_level" value="3" start-index="101"
stop-index="124" />
+ </properties>
+ </alter-storage-policy>
+</sql-parser-test-cases>
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 942a7d60e9d..05cab343952 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
@@ -2541,4 +2541,33 @@
<alter-table sql-case-id="alter_drop_tag_if_exists">
<table name="test" start-index="12" stop-index="15" />
</alter-table>
+
+ <alter-table sql-case-id="alter_table_rename_table_doris">
+ <table name="table1" start-index="12" stop-index="17" />
+ <rename-table name="table2" start-index="26" stop-index="31" />
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_rename_column_doris">
+ <table name="example_table" start-index="12" stop-index="24" />
+ <rename-column start-index="26" stop-index="44">
+ <old-column-name name="c1" start-index="40" stop-index="41" />
+ <column-name name="c2" start-index="43" stop-index="44" />
+ </rename-column>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_rename_rollup">
+ <table name="example_table" start-index="12" stop-index="24" />
+ <rename-rollup start-index="26" stop-index="54">
+ <old-rollup name="rollup1" start-index="40" stop-index="46" />
+ <new-rollup name="rollup2" start-index="48" stop-index="54" />
+ </rename-rollup>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_rename_partition">
+ <table name="example_table" start-index="12" stop-index="24" />
+ <rename-partition start-index="26" stop-index="63">
+ <old-partition name="partition1" start-index="43" stop-index="52"
/>
+ <new-partition name="partition2" start-index="54" stop-index="63"
/>
+ </rename-partition>
+ </alter-table>
</sql-parser-test-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/ddl/alter-storage-policy.xml
b/test/it/parser/src/main/resources/sql/supported/ddl/alter-storage-policy.xml
new file mode 100644
index 00000000000..b409c08b919
--- /dev/null
+++
b/test/it/parser/src/main/resources/sql/supported/ddl/alter-storage-policy.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<sql-cases>
+ <sql-case id="alter_storage_policy_with_cooldown_datetime" value="ALTER
STORAGE POLICY test_policy PROPERTIES("cooldown_datetime" =
"2023-06-08 00:00:00")" db-types="Doris" />
+ <sql-case id="alter_storage_policy_with_cooldown_ttl_number" value="ALTER
STORAGE POLICY test_policy PROPERTIES("cooldown_ttl" =
"10000")" db-types="Doris" />
+ <sql-case id="alter_storage_policy_with_cooldown_ttl_hours" value="ALTER
STORAGE POLICY test_policy PROPERTIES("cooldown_ttl" =
"1h")" db-types="Doris" />
+ <sql-case id="alter_storage_policy_with_cooldown_ttl_days" value="ALTER
STORAGE POLICY test_policy PROPERTIES("cooldown_ttl" =
"3d")" db-types="Doris" />
+ <sql-case id="alter_storage_policy_with_retention_days" value="ALTER
STORAGE POLICY prod_policy PROPERTIES("retention_days" =
"30")" db-types="Doris" />
+ <sql-case id="alter_storage_policy_with_redundancy_level" value="ALTER
STORAGE POLICY backup_policy PROPERTIES("redundancy_level" =
"2")" db-types="Doris" />
+ <sql-case id="alter_storage_policy_with_storage_type" value="ALTER STORAGE
POLICY archive_policy PROPERTIES("storage_type" = "S3")"
db-types="Doris" />
+ <sql-case id="alter_storage_policy_with_location_policy" value="ALTER
STORAGE POLICY geo_policy PROPERTIES("location_policy" =
"us-west")" db-types="Doris" />
+ <sql-case id="alter_storage_policy_with_multiple_properties" value="ALTER
STORAGE POLICY comprehensive_policy PROPERTIES("cooldown_ttl" =
"7d", "retention_days" = "90",
"redundancy_level" = "3")" db-types="Doris" />
+</sql-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 4f4b48c7d45..c587890a77d 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
@@ -371,4 +371,8 @@
<sql-case id="alter_drop_branch_if_exists" value="ALTER TABLE test DROP
BRANCH IF EXISTS branch1;" db-types="Hive" />
<sql-case id="alter_drop_tag_basic" value="ALTER TABLE test DROP TAG
tag1;" db-types="Hive" />
<sql-case id="alter_drop_tag_if_exists" value="ALTER TABLE test DROP TAG
IF EXISTS tag1;" db-types="Hive" />
+ <sql-case id="alter_table_rename_table_doris" value="ALTER TABLE table1
RENAME table2" db-types="Doris" />
+ <sql-case id="alter_table_rename_column_doris" value="ALTER TABLE
example_table RENAME COLUMN c1 c2" db-types="Doris" />
+ <sql-case id="alter_table_rename_rollup" value="ALTER TABLE example_table
RENAME ROLLUP rollup1 rollup2" db-types="Doris" />
+ <sql-case id="alter_table_rename_partition" value="ALTER TABLE
example_table RENAME PARTITION partition1 partition2" db-types="Doris" />
</sql-cases>