This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 cd741fd4b47 Support parsing Doris ADMIN CHECK TABLET and ADMIN SET
TABLE PARTITION VERSION syntax (#31483) (#39517)
cd741fd4b47 is described below
commit cd741fd4b4755c7afcf9c77f06e47adc03ea55af
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Aug 19 21:31:06 2026 +0800
Support parsing Doris ADMIN CHECK TABLET and ADMIN SET TABLE PARTITION
VERSION syntax (#31483) (#39517)
---
.../core/database/visitor/SQLVisitorRule.java | 4 ++
.../src/main/antlr4/imports/doris/DALStatement.g4 | 8 +++
.../sql/parser/autogen/DorisStatement.g4 | 2 +
.../statement/type/DorisDALStatementVisitor.java | 19 +++++++
.../doris/dal/DorisAdminCheckTabletStatement.java | 43 ++++++++++++++
.../DorisAdminSetPartitionVersionStatement.java | 42 ++++++++++++++
.../test/resources/container/mysql/cnf/5/my.cnf | 2 +-
.../test/resources/container/mysql/cnf/8/my.cnf | 2 +-
.../dal/dialect/doris/DorisDALStatementAssert.java | 10 ++++
.../type/DorisAdminCheckTabletStatementAssert.java | 63 +++++++++++++++++++++
...risAdminSetPartitionVersionStatementAssert.java | 65 ++++++++++++++++++++++
.../cases/parser/jaxb/RootSQLParserTestCases.java | 8 +++
.../DorisAdminCheckTabletStatementTestCase.java | 43 ++++++++++++++
...sAdminSetPartitionVersionStatementTestCase.java | 44 +++++++++++++++
.../main/resources/case/dal/admin-check-tablet.xml | 25 +++++++++
.../case/dal/admin-set-partition-version.xml | 33 +++++++++++
.../sql/supported/dal/admin-check-tablet.xml | 21 +++++++
.../supported/dal/admin-set-partition-version.xml | 22 ++++++++
18 files changed, 454 insertions(+), 2 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 e51d16f9d08..85819cf1ea7 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
@@ -599,6 +599,10 @@ public enum SQLVisitorRule {
ADMIN_COPY_TABLET("AdminCopyTablet", SQLStatementType.DAL),
+ ADMIN_CHECK_TABLET("AdminCheckTablet", SQLStatementType.DAL),
+
+ ADMIN_SET_PARTITION_VERSION("AdminSetPartitionVersion",
SQLStatementType.DAL),
+
ADMIN_CLEAN_TRASH("AdminCleanTrash", SQLStatementType.DAL),
ADMIN_REBALANCE_DISK("AdminRebalanceDisk", SQLStatementType.DAL),
diff --git
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4
index 1eafbd634f5..5b0caa6a0d6 100644
---
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4
+++
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4
@@ -481,6 +481,14 @@ adminCopyTablet
: ADMIN COPY TABLET NUMBER_ propertiesClause?
;
+adminCheckTablet
+ : ADMIN CHECK TABLET LP_ NUMBER_ (COMMA_ NUMBER_)* RP_ propertiesClause
+ ;
+
+adminSetPartitionVersion
+ : ADMIN SET TABLE tableName PARTITION VERSION propertiesClause
+ ;
+
adminRebalanceDisk
: ADMIN REBALANCE DISK (ON LP_ string_ (COMMA_ string_)* RP_)?
;
diff --git
a/parser/sql/engine/dialect/doris/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/DorisStatement.g4
b/parser/sql/engine/dialect/doris/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/DorisStatement.g4
index f3d9b6ba9b1..c91c4b33589 100644
---
a/parser/sql/engine/dialect/doris/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/DorisStatement.g4
+++
b/parser/sql/engine/dialect/doris/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/DorisStatement.g4
@@ -152,6 +152,8 @@ execute
| adminSetReplicaStatus
| adminSetReplicaVersion
| adminCopyTablet
+ | adminCheckTablet
+ | adminSetPartitionVersion
| adminCleanTrash
| adminRebalanceDisk
| createSqlBlockRule
diff --git
a/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java
b/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java
index a0eee0662f9..120eb933919 100644
---
a/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java
+++
b/parser/sql/engine/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/engine/doris/visitor/statement/type/DorisDALStatementVisitor.java
@@ -155,6 +155,8 @@ import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DorisAl
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AdminSetReplicaStatusContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AdminSetReplicaVersionContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AdminCopyTabletContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AdminCheckTabletContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AdminSetPartitionVersionContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.CreateSqlBlockRuleContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertiesClauseContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertyContext;
@@ -246,6 +248,8 @@ import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisPlanReplaye
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminSetReplicaStatusStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminSetReplicaVersionStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminCopyTabletStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminCheckTabletStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminSetPartitionVersionStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminRebalanceDiskStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAlterResourceStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAlterSystemStatement;
@@ -1348,6 +1352,21 @@ public final class DorisDALStatementVisitor extends
DorisStatementVisitor implem
return result;
}
+ @Override
+ public ASTNode visitAdminCheckTablet(final AdminCheckTabletContext ctx) {
+ List<Long> tabletIds = ctx.NUMBER_().stream().map(each ->
Long.parseLong(each.getText())).collect(Collectors.toList());
+ DorisAdminCheckTabletStatement result = new
DorisAdminCheckTabletStatement(getDatabaseType(), tabletIds);
+ result.setProperties(extractPropertiesSegment(ctx.propertiesClause()));
+ return result;
+ }
+
+ @Override
+ public ASTNode visitAdminSetPartitionVersion(final
AdminSetPartitionVersionContext ctx) {
+ DorisAdminSetPartitionVersionStatement result = new
DorisAdminSetPartitionVersionStatement(getDatabaseType(), (SimpleTableSegment)
visit(ctx.tableName()));
+ result.setProperties(extractPropertiesSegment(ctx.propertiesClause()));
+ return result;
+ }
+
@Override
public ASTNode visitCreateSqlBlockRule(final CreateSqlBlockRuleContext
ctx) {
DorisCreateSqlBlockRuleStatement result = new
DorisCreateSqlBlockRuleStatement(getDatabaseType());
diff --git
a/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisAdminCheckTabletStatement.java
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisAdminCheckTabletStatement.java
new file mode 100644
index 00000000000..2a2b3845c4d
--- /dev/null
+++
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisAdminCheckTabletStatement.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.sql.parser.statement.doris.dal;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.property.PropertiesSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.DALStatement;
+
+import java.util.List;
+
+/**
+ * Admin check tablet statement for Doris.
+ */
+@Getter
+@Setter
+public final class DorisAdminCheckTabletStatement extends DALStatement {
+
+ private final List<Long> tabletIds;
+
+ private PropertiesSegment properties;
+
+ public DorisAdminCheckTabletStatement(final DatabaseType databaseType,
final List<Long> tabletIds) {
+ super(databaseType);
+ this.tabletIds = tabletIds;
+ }
+}
diff --git
a/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisAdminSetPartitionVersionStatement.java
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisAdminSetPartitionVersionStatement.java
new file mode 100644
index 00000000000..aee368010d6
--- /dev/null
+++
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisAdminSetPartitionVersionStatement.java
@@ -0,0 +1,42 @@
+/*
+ * 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.dal;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.property.PropertiesSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.DALStatement;
+
+/**
+ * Admin set table partition version statement for Doris.
+ */
+@Getter
+@Setter
+public final class DorisAdminSetPartitionVersionStatement extends DALStatement
{
+
+ private final SimpleTableSegment table;
+
+ private PropertiesSegment properties;
+
+ public DorisAdminSetPartitionVersionStatement(final DatabaseType
databaseType, final SimpleTableSegment table) {
+ super(databaseType);
+ this.table = table;
+ }
+}
diff --git a/test/e2e/env/src/test/resources/container/mysql/cnf/5/my.cnf
b/test/e2e/env/src/test/resources/container/mysql/cnf/5/my.cnf
index a1c08fe4511..58d6c40a093 100644
--- a/test/e2e/env/src/test/resources/container/mysql/cnf/5/my.cnf
+++ b/test/e2e/env/src/test/resources/container/mysql/cnf/5/my.cnf
@@ -20,7 +20,7 @@
[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
-max_connections=600
+max_connections=2000
lower_case_table_names=1
innodb_lock_wait_timeout=5
default-time-zone='+00:00'
diff --git a/test/e2e/env/src/test/resources/container/mysql/cnf/8/my.cnf
b/test/e2e/env/src/test/resources/container/mysql/cnf/8/my.cnf
index 988b95f369a..df03cdad0c5 100644
--- a/test/e2e/env/src/test/resources/container/mysql/cnf/8/my.cnf
+++ b/test/e2e/env/src/test/resources/container/mysql/cnf/8/my.cnf
@@ -20,7 +20,7 @@
[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
-max_connections=600
+max_connections=2000
lower_case_table_names=1
innodb_lock_wait_timeout=5
default-time-zone='+00:00'
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java
index d5b0a1aff7a..ab12ab4dfa9 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java
@@ -26,6 +26,8 @@ import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminRebala
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCleanAllProfileStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisPlanReplayerPlayStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminCopyTabletStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminCheckTabletStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminSetPartitionVersionStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminSetReplicaStatusStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminSetReplicaVersionStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAlterResourceStatement;
@@ -63,6 +65,8 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.d
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisCleanAllProfileStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisPlanReplayerPlayStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisAdminCopyTabletStatementAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisAdminCheckTabletStatementAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisAdminSetPartitionVersionStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisAdminSetReplicaStatusStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisAdminSetReplicaVersionStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisAlterResourceStatementAssert;
@@ -101,6 +105,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.statement.dal.dialect.doris.DorisCleanAllProfileStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisPlanReplayerPlayStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminCopyTabletStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminCheckTabletStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminSetPartitionVersionStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminSetReplicaStatusStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminSetReplicaVersionStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAlterResourceStatementTestCase;
@@ -188,6 +194,10 @@ public final class DorisDALStatementAssert {
DorisAdminSetReplicaVersionStatementAssert.assertIs(assertContext,
(DorisAdminSetReplicaVersionStatement) actual,
(DorisAdminSetReplicaVersionStatementTestCase) expected);
} else if (actual instanceof DorisAdminCopyTabletStatement) {
DorisAdminCopyTabletStatementAssert.assertIs(assertContext,
(DorisAdminCopyTabletStatement) actual, (DorisAdminCopyTabletStatementTestCase)
expected);
+ } else if (actual instanceof DorisAdminCheckTabletStatement) {
+ DorisAdminCheckTabletStatementAssert.assertIs(assertContext,
(DorisAdminCheckTabletStatement) actual,
(DorisAdminCheckTabletStatementTestCase) expected);
+ } else if (actual instanceof DorisAdminSetPartitionVersionStatement) {
+
DorisAdminSetPartitionVersionStatementAssert.assertIs(assertContext,
(DorisAdminSetPartitionVersionStatement) actual,
(DorisAdminSetPartitionVersionStatementTestCase) expected);
} else if (actual instanceof DorisShowFileStatement) {
DorisShowFileStatementAssert.assertIs(assertContext,
(DorisShowFileStatement) actual, (DorisShowFileStatementTestCase) expected);
} else if (actual instanceof DorisShowEncryptKeysStatement) {
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisAdminCheckTabletStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisAdminCheckTabletStatementAssert.java
new file mode 100644
index 00000000000..144e720003c
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisAdminCheckTabletStatementAssert.java
@@ -0,0 +1,63 @@
+/*
+ * 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.dal.dialect.doris.type;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.property.PropertySegment;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminCheckTabletStatement;
+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.statement.dal.dialect.doris.DorisAdminCheckTabletStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.PropertyTestCase;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+/**
+ * Admin check tablet statement assert for Doris.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DorisAdminCheckTabletStatementAssert {
+
+ /**
+ * Assert admin check tablet statement is correct with expected parser
result.
+ *
+ * @param assertContext assert context
+ * @param actual actual admin check tablet statement
+ * @param expected expected admin check tablet statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final DorisAdminCheckTabletStatement actual, final
DorisAdminCheckTabletStatementTestCase expected) {
+ assertThat(assertContext.getText("Tablet IDs size does not match: "),
actual.getTabletIds().size(), is(expected.getTabletIds().size()));
+ for (int i = 0; i < expected.getTabletIds().size(); i++) {
+ assertThat(assertContext.getText("Tablet ID does not match: "),
actual.getTabletIds().get(i), is(expected.getTabletIds().get(i)));
+ }
+ if (!expected.getProperties().isEmpty()) {
+ assertThat(assertContext.getText("Properties size does not match:
"), actual.getProperties().getProperties().size(),
is(expected.getProperties().size()));
+ for (int i = 0; i < expected.getProperties().size(); i++) {
+ assertProperty(assertContext,
actual.getProperties().getProperties().get(i), expected.getProperties().get(i));
+ }
+ }
+ }
+
+ private static void assertProperty(final SQLCaseAssertContext
assertContext, final PropertySegment actual, final PropertyTestCase 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/statement/dal/dialect/doris/type/DorisAdminSetPartitionVersionStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisAdminSetPartitionVersionStatementAssert.java
new file mode 100644
index 00000000000..d0ddfd5b2cb
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisAdminSetPartitionVersionStatementAssert.java
@@ -0,0 +1,65 @@
+/*
+ * 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.dal.dialect.doris.type;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.property.PropertySegment;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAdminSetPartitionVersionStatement;
+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.table.TableAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminSetPartitionVersionStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.PropertyTestCase;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+/**
+ * Admin set table partition version statement assert for Doris.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DorisAdminSetPartitionVersionStatementAssert {
+
+ /**
+ * Assert admin set table partition version statement is correct with
expected parser result.
+ *
+ * @param assertContext assert context
+ * @param actual actual admin set table partition version statement
+ * @param expected expected admin set table partition version statement
test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final DorisAdminSetPartitionVersionStatement actual,
+ final
DorisAdminSetPartitionVersionStatementTestCase expected) {
+ assertNotNull(actual.getTable(), assertContext.getText("Table should
not be null"));
+ TableAssert.assertIs(assertContext, actual.getTable(),
expected.getTable());
+ assertNotNull(actual.getProperties(),
assertContext.getText("Properties should not be null"));
+ if (!expected.getProperties().isEmpty()) {
+ assertThat(assertContext.getText("Properties size does not match:
"), actual.getProperties().getProperties().size(),
is(expected.getProperties().size()));
+ for (int i = 0; i < expected.getProperties().size(); i++) {
+ assertProperty(assertContext,
actual.getProperties().getProperties().get(i), expected.getProperties().get(i));
+ }
+ }
+ }
+
+ private static void assertProperty(final SQLCaseAssertContext
assertContext, final PropertySegment actual, final PropertyTestCase 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 6f7d689d835..3b274b431ad 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,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.statement.dal.dialect.doris.DorisAdminCleanTrashStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminRebalanceDiskStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminCopyTabletStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminCheckTabletStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminSetPartitionVersionStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminSetReplicaStatusStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAdminSetReplicaVersionStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAlterResourceStatementTestCase;
@@ -840,6 +842,12 @@ public final class RootSQLParserTestCases {
@XmlElement(name = "admin-copy-tablet")
private final List<DorisAdminCopyTabletStatementTestCase>
adminCopyTabletTestCases = new LinkedList<>();
+ @XmlElement(name = "admin-check-tablet")
+ private final List<DorisAdminCheckTabletStatementTestCase>
adminCheckTabletTestCases = new LinkedList<>();
+
+ @XmlElement(name = "admin-set-partition-version")
+ private final List<DorisAdminSetPartitionVersionStatementTestCase>
adminSetPartitionVersionTestCases = new LinkedList<>();
+
@XmlElement(name = "create-sql-block-rule")
private final List<DorisCreateSqlBlockRuleStatementTestCase>
createSqlBlockRuleTestCases = new LinkedList<>();
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisAdminCheckTabletStatementTestCase.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisAdminCheckTabletStatementTestCase.java
new file mode 100644
index 00000000000..170f618add6
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisAdminCheckTabletStatementTestCase.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.dal.dialect.doris;
+
+import lombok.Getter;
+import lombok.Setter;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase;
+
+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;
+
+/**
+ * Admin check tablet statement test case for Doris.
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@Getter
+@Setter
+public final class DorisAdminCheckTabletStatementTestCase extends
SQLParserTestCase {
+
+ @XmlElement(name = "tablet-id")
+ private final List<Long> tabletIds = new LinkedList<>();
+
+ @XmlElement(name = "property")
+ private final List<PropertyTestCase> properties = new LinkedList<>();
+}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisAdminSetPartitionVersionStatementTestCase.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisAdminSetPartitionVersionStatementTestCase.java
new file mode 100644
index 00000000000..2c159eff97d
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisAdminSetPartitionVersionStatementTestCase.java
@@ -0,0 +1,44 @@
+/*
+ * 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.dal.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.table.ExpectedSimpleTable;
+
+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;
+
+/**
+ * Admin set table partition version statement test case for Doris.
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@Getter
+@Setter
+public final class DorisAdminSetPartitionVersionStatementTestCase extends
SQLParserTestCase {
+
+ @XmlElement
+ private ExpectedSimpleTable table;
+
+ @XmlElement(name = "property")
+ private final List<PropertyTestCase> properties = new LinkedList<>();
+}
diff --git a/test/it/parser/src/main/resources/case/dal/admin-check-tablet.xml
b/test/it/parser/src/main/resources/case/dal/admin-check-tablet.xml
new file mode 100644
index 00000000000..5eae11acfc7
--- /dev/null
+++ b/test/it/parser/src/main/resources/case/dal/admin-check-tablet.xml
@@ -0,0 +1,25 @@
+<?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>
+ <admin-check-tablet sql-case-id="admin_check_tablet">
+ <tablet-id>10000</tablet-id>
+ <tablet-id>10001</tablet-id>
+ <property key="type" value="consistency" start-index="45"
stop-index="66" />
+ </admin-check-tablet>
+</sql-parser-test-cases>
diff --git
a/test/it/parser/src/main/resources/case/dal/admin-set-partition-version.xml
b/test/it/parser/src/main/resources/case/dal/admin-set-partition-version.xml
new file mode 100644
index 00000000000..2889f2e5fe0
--- /dev/null
+++ b/test/it/parser/src/main/resources/case/dal/admin-set-partition-version.xml
@@ -0,0 +1,33 @@
+<?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>
+ <admin-set-partition-version sql-case-id="admin_set_partition_version">
+ <table name="tbl1" start-index="16" stop-index="19" />
+ <property key="partition_id" value="1769152" start-index="50"
stop-index="75" />
+ <property key="visible_version" value="100" start-index="78"
stop-index="102" />
+ </admin-set-partition-version>
+
+ <admin-set-partition-version
sql-case-id="admin_set_partition_version_with_qualified_table">
+ <table name="audit_log" start-index="16" stop-index="42">
+ <owner name="__internal_schema" start-index="16" stop-index="32" />
+ </table>
+ <property key="partition_id" value="10075" start-index="73"
stop-index="96" />
+ <property key="visible_version" value="100" start-index="99"
stop-index="123" />
+ </admin-set-partition-version>
+</sql-parser-test-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/dal/admin-check-tablet.xml
b/test/it/parser/src/main/resources/sql/supported/dal/admin-check-tablet.xml
new file mode 100644
index 00000000000..36871f36248
--- /dev/null
+++ b/test/it/parser/src/main/resources/sql/supported/dal/admin-check-tablet.xml
@@ -0,0 +1,21 @@
+<?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="admin_check_tablet" value="ADMIN CHECK TABLET (10000, 10001)
PROPERTIES("type" = "consistency")" db-types="Doris" />
+</sql-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/dal/admin-set-partition-version.xml
b/test/it/parser/src/main/resources/sql/supported/dal/admin-set-partition-version.xml
new file mode 100644
index 00000000000..faac12f1118
--- /dev/null
+++
b/test/it/parser/src/main/resources/sql/supported/dal/admin-set-partition-version.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="admin_set_partition_version" value="ADMIN SET TABLE tbl1
PARTITION VERSION PROPERTIES("partition_id" = "1769152",
"visible_version" = "100")" db-types="Doris" />
+ <sql-case id="admin_set_partition_version_with_qualified_table"
value="ADMIN SET TABLE __internal_schema.audit_log PARTITION VERSION
PROPERTIES("partition_id" = "10075",
"visible_version" = "100")" db-types="Doris" />
+</sql-cases>