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 4b6956ce87a Support parsing Doris ALTER COLOCATE GROUP syntax (#38282)
4b6956ce87a is described below
commit 4b6956ce87abefb3831162342be9f352fed2b1f9
Author: cxy <[email protected]>
AuthorDate: Sun Mar 1 19:14:08 2026 +0800
Support parsing Doris ALTER COLOCATE GROUP syntax (#38282)
---
.../core/database/visitor/SQLVisitorRule.java | 2 +
.../src/main/antlr4/imports/doris/BaseRule.g4 | 1 +
.../src/main/antlr4/imports/doris/DDLStatement.g4 | 5 ++
.../src/main/antlr4/imports/doris/DorisKeyword.g4 | 4 ++
.../statement/type/DorisDDLStatementVisitor.java | 15 ++++
.../ddl/colocategroup/ColocateGroupSegment.java | 50 +++++++++++++
.../ddl/DorisAlterColocateGroupStatement.java | 41 +++++++++++
.../ddl/dialect/doris/DorisDDLStatementAssert.java | 5 ++
.../DorisAlterColocateGroupStatementAssert.java | 84 ++++++++++++++++++++++
.../cases/parser/jaxb/RootSQLParserTestCases.java | 4 ++
.../impl/colocategroup/ExpectedColocateGroup.java | 36 ++++++++++
.../DorisAlterColocateGroupStatementTestCase.java | 43 +++++++++++
.../resources/case/ddl/alter-colocate-group.xml | 35 +++++++++
.../sql/supported/ddl/alter-colocate-group.xml | 22 ++++++
14 files changed, 347 insertions(+)
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 7bb6b8c6d69..3a70fae2f9c 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
@@ -305,6 +305,8 @@ public enum SQLVisitorRule {
ALTER_CATALOG("AlterCatalog", SQLStatementType.DDL),
+ ALTER_COLOCATE_GROUP("AlterColocateGroup", SQLStatementType.DDL),
+
SET_CONSTRAINTS("SetConstraints", SQLStatementType.TCL),
SET_TRANSACTION("SetTransaction", SQLStatementType.TCL),
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 c2cbe619f1b..2f23f17222e 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
@@ -176,6 +176,7 @@ identifierKeywordsUnambiguous
| COALESCE
| CODE
| COLLATION
+ | COLOCATE
| COLUMNS
| COLUMN_FORMAT
| COLUMN_NAME
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 7752d04a71e..d04bbb69944 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
@@ -31,6 +31,7 @@ alterStatement
| alterServer
| alterCatalog
| alterStoragePolicy
+ | alterColocateGroup
;
createTable
@@ -168,6 +169,10 @@ alterStoragePolicy
: ALTER STORAGE POLICY identifier propertiesClause
;
+alterColocateGroup
+ : ALTER COLOCATE GROUP (databaseName DOT_)? identifier SET LP_ properties
RP_
+ ;
+
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 b6264b0e149..91e0c971f8f 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
@@ -345,6 +345,10 @@ COLLATION
: C O L L A T I O N
;
+COLOCATE
+ : C O L O C A T E
+ ;
+
COLUMN
: C O L U M N
;
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 c14c002021c..f15a000bbbb 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
@@ -135,6 +135,7 @@ import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RenameR
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.RenamePartitionContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ReplaceTableContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterPartitionContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterColocateGroupContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterStoragePolicyContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DorisPartitionDescContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DistributedbyClauseContext;
@@ -181,6 +182,7 @@ import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.partition
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.partition.PartitionValuesSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.partition.RenamePartitionDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.IntervalUnitSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.colocategroup.ColocateGroupSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.policy.PolicyNameSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.property.PropertiesSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.property.PropertySegment;
@@ -259,6 +261,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.DorisAlterColocateGroupStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisAlterStoragePolicyStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisCreateFunctionStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisDropFunctionStatement;
@@ -1359,6 +1362,18 @@ public final class DorisDDLStatementVisitor extends
DorisStatementVisitor implem
return new DorisAlterStoragePolicyStatement(getDatabaseType(),
policyNameSegment, propertiesSegment);
}
+ @Override
+ public ASTNode visitAlterColocateGroup(final AlterColocateGroupContext
ctx) {
+ IdentifierValue groupIdentifier = (IdentifierValue)
visit(ctx.identifier());
+ ColocateGroupSegment groupSegment = new
ColocateGroupSegment(ctx.identifier().getStart().getStartIndex(),
ctx.identifier().getStop().getStopIndex(), groupIdentifier);
+ if (null != ctx.databaseName()) {
+ groupSegment
+ .setOwner(new
OwnerSegment(ctx.databaseName().getStart().getStartIndex(),
ctx.databaseName().getStop().getStopIndex(), (IdentifierValue)
visit(ctx.databaseName().identifier())));
+ }
+ PropertiesSegment propertiesSegment =
extractPropertiesSegmentFromPropertiesContext(ctx.properties());
+ return new DorisAlterColocateGroupStatement(getDatabaseType(),
groupSegment, propertiesSegment);
+ }
+
private PropertiesSegment extractPropertiesSegment(final
PropertiesClauseContext ctx) {
PropertiesSegment result = new
PropertiesSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex());
for (PropertyContext each : ctx.properties().property()) {
diff --git
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/colocategroup/ColocateGroupSegment.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/colocategroup/ColocateGroupSegment.java
new file mode 100644
index 00000000000..b72d4cfd1ca
--- /dev/null
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/segment/ddl/colocategroup/ColocateGroupSegment.java
@@ -0,0 +1,50 @@
+/*
+ * 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.colocategroup;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import org.apache.shardingsphere.sql.parser.statement.core.segment.SQLSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.OwnerAvailable;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.OwnerSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
+
+import java.util.Optional;
+
+/**
+ * Colocate group segment.
+ */
+@RequiredArgsConstructor
+@Getter
+@Setter
+public final class ColocateGroupSegment implements SQLSegment, OwnerAvailable {
+
+ private final int startIndex;
+
+ private final int stopIndex;
+
+ private final IdentifierValue identifier;
+
+ private OwnerSegment owner;
+
+ @Override
+ public Optional<OwnerSegment> getOwner() {
+ return Optional.ofNullable(owner);
+ }
+}
diff --git
a/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/ddl/DorisAlterColocateGroupStatement.java
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/ddl/DorisAlterColocateGroupStatement.java
new file mode 100644
index 00000000000..255bf8edc6e
--- /dev/null
+++
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/ddl/DorisAlterColocateGroupStatement.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.colocategroup.ColocateGroupSegment;
+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 colocate group statement for Doris.
+ */
+@Getter
+public final class DorisAlterColocateGroupStatement extends DDLStatement {
+
+ private final ColocateGroupSegment groupName;
+
+ private final PropertiesSegment properties;
+
+ public DorisAlterColocateGroupStatement(final DatabaseType databaseType,
final ColocateGroupSegment groupName, final PropertiesSegment properties) {
+ super(databaseType);
+ this.groupName = groupName;
+ this.properties = properties;
+ }
+}
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 8c39f0e303a..d7626cead13 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,6 +20,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.statement.type.ddl.DDLStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisAlterColocateGroupStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisAlterStoragePolicyStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisCreateFunctionStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisDropFunctionStatement;
@@ -30,8 +31,10 @@ import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisStopSyncJob
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisCreateJobStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.ddl.DorisCreateSyncJobStatement;
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.DorisAlterColocateGroupStatementAssert;
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.DorisAlterColocateGroupStatementTestCase;
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.DorisCreateJobStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisDropFunctionStatementTestCase;
@@ -74,6 +77,8 @@ public final class DorisDDLStatementAssert {
DorisStopSyncJobStatementAssert.assertIs(assertContext,
(DorisStopSyncJobStatement) actual, (DorisStopSyncJobStatementTestCase)
expected);
} else if (actual instanceof DorisCreateJobStatement) {
DorisCreateJobStatementAssert.assertIs(assertContext,
(DorisCreateJobStatement) actual, (DorisCreateJobStatementTestCase) expected);
+ } else if (actual instanceof DorisAlterColocateGroupStatement) {
+ DorisAlterColocateGroupStatementAssert.assertIs(assertContext,
(DorisAlterColocateGroupStatement) actual,
(DorisAlterColocateGroupStatementTestCase) expected);
}
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/type/DorisAlterColocateGroupStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/type/DorisAlterColocateGroupStatementAssert.java
new file mode 100644
index 00000000000..0155aa550dd
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/ddl/dialect/doris/type/DorisAlterColocateGroupStatementAssert.java
@@ -0,0 +1,84 @@
+/*
+ * 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.core.segment.ddl.colocategroup.ColocateGroupSegment;
+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.doris.ddl.DorisAlterColocateGroupStatement;
+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.asserts.segment.identifier.IdentifierValueAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.owner.OwnerAssert;
+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.colocategroup.ExpectedColocateGroup;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisAlterColocateGroupStatementTestCase;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Alter colocate group statement assert for Doris.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DorisAlterColocateGroupStatementAssert {
+
+ /**
+ * Assert alter colocate group statement is correct with expected parser
result.
+ *
+ * @param assertContext assert context
+ * @param actual actual alter colocate group statement
+ * @param expected expected alter colocate group statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final DorisAlterColocateGroupStatement actual, final
DorisAlterColocateGroupStatementTestCase expected) {
+ assertGroupName(assertContext, actual.getGroupName(),
expected.getGroupName());
+ if (null != expected.getProperties()) {
+ assertProperties(assertContext, actual.getProperties(),
expected.getProperties());
+ }
+ }
+
+ private static void assertGroupName(final SQLCaseAssertContext
assertContext, final ColocateGroupSegment actual, final ExpectedColocateGroup
expected) {
+ IdentifierValueAssert.assertIs(assertContext, actual.getIdentifier(),
expected, "Colocate group");
+ SQLSegmentAssert.assertIs(assertContext, actual, expected);
+ if (null == expected.getOwner()) {
+ assertFalse(actual.getOwner().isPresent(),
assertContext.getText("Actual owner should not exist."));
+ } else {
+ assertTrue(actual.getOwner().isPresent(),
assertContext.getText("Actual owner should exist."));
+ OwnerAssert.assertIs(assertContext, actual.getOwner().get(),
expected.getOwner());
+ }
+ }
+
+ private 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/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 2747495c648..598e75d94fe 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
@@ -27,6 +27,7 @@ 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.statement.dal.dialect.doris.DorisDropRepositoryStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisSwitchStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.CreateEncryptKeyStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisAlterColocateGroupStatementTestCase;
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.DorisDropFunctionStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.dialect.doris.DorisResumeJobStatementTestCase;
@@ -894,6 +895,9 @@ public final class RootSQLParserTestCases {
@XmlElement(name = "alter-storage-policy")
private final List<DorisAlterStoragePolicyStatementTestCase>
alterStoragePolicyTestCases = new LinkedList<>();
+ @XmlElement(name = "alter-colocate-group")
+ private final List<DorisAlterColocateGroupStatementTestCase>
alterColocateGroupTestCases = 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/colocategroup/ExpectedColocateGroup.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/colocategroup/ExpectedColocateGroup.java
new file mode 100644
index 00000000000..b46ccfc76f1
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/colocategroup/ExpectedColocateGroup.java
@@ -0,0 +1,36 @@
+/*
+ * 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.colocategroup;
+
+import lombok.Getter;
+import lombok.Setter;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.AbstractExpectedIdentifierSQLSegment;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.table.ExpectedOwner;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * Expected colocate group.
+ */
+@Getter
+@Setter
+public final class ExpectedColocateGroup extends
AbstractExpectedIdentifierSQLSegment {
+
+ @XmlElement
+ private ExpectedOwner owner;
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/dialect/doris/DorisAlterColocateGroupStatementTestCase.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/dialect/doris/DorisAlterColocateGroupStatementTestCase.java
new file mode 100644
index 00000000000..a6373bc81ef
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/ddl/dialect/doris/DorisAlterColocateGroupStatementTestCase.java
@@ -0,0 +1,43 @@
+/*
+ * 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.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.colocategroup.ExpectedColocateGroup;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * Alter colocate group statement test case for Doris.
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@Getter
+@Setter
+public final class DorisAlterColocateGroupStatementTestCase extends
SQLParserTestCase {
+
+ @XmlElement(name = "group-name")
+ private ExpectedColocateGroup groupName;
+
+ @XmlElement(name = "properties")
+ private ExpectedCatalogProperties properties;
+}
diff --git
a/test/it/parser/src/main/resources/case/ddl/alter-colocate-group.xml
b/test/it/parser/src/main/resources/case/ddl/alter-colocate-group.xml
new file mode 100644
index 00000000000..c6506d0b3b0
--- /dev/null
+++ b/test/it/parser/src/main/resources/case/ddl/alter-colocate-group.xml
@@ -0,0 +1,35 @@
+<?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-colocate-group sql-case-id="alter_colocate_group_global">
+ <group-name name="__global__foo" start-index="21" stop-index="33" />
+ <properties start-index="40" stop-index="60">
+ <property key="replication_num" value="1" start-index="40"
stop-index="60" />
+ </properties>
+ </alter-colocate-group>
+
+ <alter-colocate-group sql-case-id="alter_colocate_group_with_database">
+ <group-name name="bar" start-index="32" stop-index="34">
+ <owner name="example_db" start-index="21" stop-index="30" />
+ </group-name>
+ <properties start-index="41" stop-index="61">
+ <property key="replication_num" value="1" start-index="41"
stop-index="61" />
+ </properties>
+ </alter-colocate-group>
+</sql-parser-test-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/ddl/alter-colocate-group.xml
b/test/it/parser/src/main/resources/sql/supported/ddl/alter-colocate-group.xml
new file mode 100644
index 00000000000..74eefa2389a
--- /dev/null
+++
b/test/it/parser/src/main/resources/sql/supported/ddl/alter-colocate-group.xml
@@ -0,0 +1,22 @@
+<?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_colocate_group_global" value="ALTER COLOCATE GROUP
__global__foo SET ("replication_num"="1")" db-types="Doris"
/>
+ <sql-case id="alter_colocate_group_with_database" value="ALTER COLOCATE
GROUP example_db.bar SET ("replication_num"="1")"
db-types="Doris" />
+</sql-cases>