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 c678e88cddc Support for the CREATE WORKLOAD GROUP statement and the
ANALYZE TABLE statement for Doris (#39518)
c678e88cddc is described below
commit c678e88cddc93e5b8bafe26088491c047c9a8522
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Aug 19 22:33:54 2026 +0800
Support for the CREATE WORKLOAD GROUP statement and the ANALYZE TABLE
statement for Doris (#39518)
* Support for the CREATE WORKLOAD GROUP statement and the ANALYZE TABLE
statement for Doris
- Add CREATE WORKLOAD GROUP [IF NOT EXISTS] grammar with a new
DorisCreateWorkloadGroupStatement carrying group name and properties
- Extend Doris ANALYZE TABLE with an optional column list and WITH SYNC /
WITH SAMPLE PERCENT|ROWS analyze options
- Add InternalSQLParserIT cases with expected parser assertions for both
statements
Fixes #31486
* Support for the CREATE WORKLOAD GROUP statement and the ANALYZE TABLE
statement for Doris
- Add CREATE WORKLOAD GROUP [IF NOT EXISTS] grammar with a new
DorisCreateWorkloadGroupStatement carrying group name and properties
- Extend Doris ANALYZE TABLE with an optional column list and WITH SYNC /
WITH SAMPLE PERCENT|ROWS analyze options
- Add InternalSQLParserIT cases with expected parser assertions for both
statements
Fixes #31486
---
.../core/database/visitor/SQLVisitorRule.java | 2 +
.../src/main/antlr4/imports/doris/BaseRule.g4 | 9 +++
.../src/main/antlr4/imports/doris/DALStatement.g4 | 17 +++++-
.../src/main/antlr4/imports/doris/DorisKeyword.g4 | 12 ++++
.../sql/parser/autogen/DorisStatement.g4 | 1 +
.../statement/type/DorisDALStatementVisitor.java | 10 ++++
.../dal/DorisCreateWorkloadGroupStatement.java | 40 ++++++++++++++
.../dal/dialect/doris/DorisDALStatementAssert.java | 5 ++
.../DorisCreateWorkloadGroupStatementAssert.java | 64 ++++++++++++++++++++++
.../cases/parser/jaxb/RootSQLParserTestCases.java | 4 ++
.../DorisCreateWorkloadGroupStatementTestCase.java | 43 +++++++++++++++
.../src/main/resources/case/dal/analyze-table.xml | 2 +
.../parser/src/main/resources/case/dal/create.xml | 14 +++++
.../resources/sql/supported/dal/analyze-table.xml | 2 +
.../main/resources/sql/supported/dal/create.xml | 3 +
15 files changed, 227 insertions(+), 1 deletion(-)
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 85819cf1ea7..18709104fa5 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
@@ -621,6 +621,8 @@ public enum SQLVisitorRule {
CREATE_SQL_BLOCK_RULE("CreateSqlBlockRule", SQLStatementType.DAL),
+ CREATE_WORKLOAD_GROUP("CreateWorkloadGroup", SQLStatementType.DAL),
+
DELIMITER("Delimiter", SQLStatementType.DAL),
CALL("Call", SQLStatementType.DML),
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 75f7111631f..51bd0fda88d 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
@@ -403,6 +403,9 @@ identifierKeywordsUnambiguous
| PASSWORD_LOCK_TIME
| PATH
| PAUSE
+ // DORIS ADDED BEGIN
+ | PERCENT
+ // DORIS ADDED END
| PHASE
// DORIS ADDED BEGIN
| PLAN
@@ -479,6 +482,9 @@ identifierKeywordsUnambiguous
| ROW_COUNT
| ROW_FORMAT
| RTREE
+ // DORIS ADDED BEGIN
+ | SAMPLE
+ // DORIS ADDED END
| SCHEDULE
| SCHEMA_NAME
| SECONDARY_ENGINE
@@ -579,6 +585,9 @@ identifierKeywordsUnambiguous
| WEIGHT_STRING
| WITHOUT
| WORK
+ // DORIS ADDED BEGIN
+ | WORKLOAD
+ // DORIS ADDED END
| WRAPPER
| X509
| XID
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 5b0caa6a0d6..7b0117d2fc1 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
@@ -380,9 +380,18 @@ uninstallPlugin
: UNINSTALL PLUGIN pluginName
;
+// DORIS CHANGED BEGIN
analyzeTable
- : ANALYZE (NO_WRITE_TO_BINLOG | LOCAL)? tableOrTables tableList histogram?
+ : ANALYZE (NO_WRITE_TO_BINLOG | LOCAL)? tableOrTables tableList (LP_
columnNames RP_)? analyzeOption* histogram?
;
+// DORIS CHANGED END
+
+// DORIS ADDED BEGIN
+analyzeOption
+ : WITH SYNC
+ | WITH SAMPLE (PERCENT | ROWS) numberLiterals
+ ;
+// DORIS ADDED END
histogram
: UPDATE HISTOGRAM ON columnNames (WITH NUMBER_ BUCKETS | USING DATA
string_)?
@@ -598,6 +607,12 @@ createResourceGroup
(THREAD_PRIORITY EQ_? numberLiterals)? (ENABLE | DISABLE)?
;
+// DORIS ADDED BEGIN
+createWorkloadGroup
+ : CREATE WORKLOAD GROUP ifNotExists? groupName propertiesClause
+ ;
+// DORIS ADDED END
+
dropResourceGroup
: DROP RESOURCE GROUP groupName FORCE?
;
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 4c09e8f9f0a..012cec777c2 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
@@ -2010,6 +2010,10 @@ PAUSE
: P A U S E
;
+PERCENT
+ : P E R C E N T
+ ;
+
PERCENT_RANK
: P E R C E N T UL_ R A N K
;
@@ -2486,6 +2490,10 @@ RTREE
: R T R E E
;
+SAMPLE
+ : S A M P L E
+ ;
+
SAVEPOINT
: S A V E P O I N T
;
@@ -3320,6 +3328,10 @@ WORK
: W O R K
;
+WORKLOAD
+ : W O R K L O A D
+ ;
+
WRAPPER
: W R A P P E R
;
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 c91c4b33589..5b65df5f2ae 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
@@ -55,6 +55,7 @@ execute
| alterResourceGroup
| alterResource
| createResourceGroup
+ | createWorkloadGroup
| dropResourceGroup
| prepare
| executeStmt
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 120eb933919..f4e1f59b98b 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
@@ -158,6 +158,7 @@ import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AdminCo
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.CreateWorkloadGroupContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertiesClauseContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertyContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.DorisAlterSystemActionContext;
@@ -257,6 +258,7 @@ import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisBackupState
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCancelBackupStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCancelLoadStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCreateSqlBlockRuleStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCreateWorkloadGroupStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCreateRepositoryStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisSwitchStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAlterSqlBlockRuleStatement;
@@ -1375,6 +1377,14 @@ public final class DorisDALStatementVisitor extends
DorisStatementVisitor implem
return result;
}
+ @Override
+ public ASTNode visitCreateWorkloadGroup(final CreateWorkloadGroupContext
ctx) {
+ DorisCreateWorkloadGroupStatement result = new
DorisCreateWorkloadGroupStatement(getDatabaseType());
+ result.setGroupName(((IdentifierValue)
visit(ctx.groupName())).getValue());
+ result.setProperties(extractPropertiesSegment(ctx.propertiesClause()));
+ return result;
+ }
+
@Override
public ASTNode visitAlterSqlBlockRule(final AlterSqlBlockRuleContext ctx) {
DorisAlterSqlBlockRuleStatement result = new
DorisAlterSqlBlockRuleStatement(getDatabaseType());
diff --git
a/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisCreateWorkloadGroupStatement.java
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisCreateWorkloadGroupStatement.java
new file mode 100644
index 00000000000..53738016d8d
--- /dev/null
+++
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisCreateWorkloadGroupStatement.java
@@ -0,0 +1,40 @@
+/*
+ * 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;
+
+/**
+ * Create workload group statement for Doris.
+ */
+@Getter
+@Setter
+public final class DorisCreateWorkloadGroupStatement extends DALStatement {
+
+ private String groupName;
+
+ private PropertiesSegment properties;
+
+ public DorisCreateWorkloadGroupStatement(final DatabaseType databaseType) {
+ super(databaseType);
+ }
+}
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 ab12ab4dfa9..1793d409015 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
@@ -36,6 +36,7 @@ import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisBackupState
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCancelBackupStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCancelLoadStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCreateSqlBlockRuleStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCreateWorkloadGroupStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCreateRepositoryStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisDescFunctionStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisDropRepositoryStatement;
@@ -75,6 +76,7 @@ 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.DorisCancelBackupStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisCancelLoadStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisCreateSqlBlockRuleStatementAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisCreateWorkloadGroupStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisCreateRepositoryStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisDescFunctionStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisDropRepositoryStatementAssert;
@@ -115,6 +117,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.DorisCancelBackupStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCancelLoadStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCreateSqlBlockRuleStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCreateWorkloadGroupStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCreateRepositoryStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisDescFunctionStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisDropRepositoryStatementTestCase;
@@ -160,6 +163,8 @@ public final class DorisDALStatementAssert {
DorisAlterSystemStatementAssert.assertIs(assertContext,
(DorisAlterSystemStatement) actual, (DorisAlterSystemStatementTestCase)
expected);
} else if (actual instanceof DorisCreateSqlBlockRuleStatement) {
DorisCreateSqlBlockRuleStatementAssert.assertIs(assertContext,
(DorisCreateSqlBlockRuleStatement) actual,
(DorisCreateSqlBlockRuleStatementTestCase) expected);
+ } else if (actual instanceof DorisCreateWorkloadGroupStatement) {
+ DorisCreateWorkloadGroupStatementAssert.assertIs(assertContext,
(DorisCreateWorkloadGroupStatement) actual,
(DorisCreateWorkloadGroupStatementTestCase) expected);
} else if (actual instanceof DorisShowQueryStatsStatement) {
DorisShowQueryStatsStatementAssert.assertIs(assertContext,
(DorisShowQueryStatsStatement) actual, (DorisShowQueryStatsStatementTestCase)
expected);
} else if (actual instanceof DorisSwitchStatement) {
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisCreateWorkloadGroupStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisCreateWorkloadGroupStatementAssert.java
new file mode 100644
index 00000000000..e879c0cc037
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisCreateWorkloadGroupStatementAssert.java
@@ -0,0 +1,64 @@
+/*
+ * 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.DorisCreateWorkloadGroupStatement;
+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.DorisCreateWorkloadGroupStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.PropertyTestCase;
+
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+/**
+ * Create workload group statement assert for Doris.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DorisCreateWorkloadGroupStatementAssert {
+
+ /**
+ * Assert create workload group statement is correct with expected parser
result.
+ *
+ * @param assertContext assert context
+ * @param actual actual create workload group statement
+ * @param expected expected create workload group statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final DorisCreateWorkloadGroupStatement actual, final
DorisCreateWorkloadGroupStatementTestCase expected) {
+ if (null != expected.getGroupName()) {
+ assertThat(assertContext.getText("Group name does not match: "),
actual.getGroupName(), is(expected.getGroupName()));
+ }
+ 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 3b274b431ad..2a14a38b33b 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
@@ -40,6 +40,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.DorisCleanAllProfileStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCreateRepositoryStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCreateSqlBlockRuleStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisCreateWorkloadGroupStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisDescFunctionStatementTestCase;
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.DorisDropSqlBlockRuleStatementTestCase;
@@ -851,6 +852,9 @@ public final class RootSQLParserTestCases {
@XmlElement(name = "create-sql-block-rule")
private final List<DorisCreateSqlBlockRuleStatementTestCase>
createSqlBlockRuleTestCases = new LinkedList<>();
+ @XmlElement(name = "create-workload-group")
+ private final List<DorisCreateWorkloadGroupStatementTestCase>
createWorkloadGroupTestCases = new LinkedList<>();
+
@XmlElement(name = "set-default-role")
private final List<MySQLSetDefaultRoleStatementTestCase>
setDefaultRoleTestCases = 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/DorisCreateWorkloadGroupStatementTestCase.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisCreateWorkloadGroupStatementTestCase.java
new file mode 100644
index 00000000000..ecafd806e0a
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisCreateWorkloadGroupStatementTestCase.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;
+
+/**
+ * Create workload group statement test case for Doris.
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@Getter
+@Setter
+public final class DorisCreateWorkloadGroupStatementTestCase extends
SQLParserTestCase {
+
+ @XmlElement(name = "group-name")
+ private String groupName;
+
+ @XmlElement(name = "property")
+ private final List<PropertyTestCase> properties = new LinkedList<>();
+}
diff --git a/test/it/parser/src/main/resources/case/dal/analyze-table.xml
b/test/it/parser/src/main/resources/case/dal/analyze-table.xml
index c7e8bb85662..f039bd2aa37 100644
--- a/test/it/parser/src/main/resources/case/dal/analyze-table.xml
+++ b/test/it/parser/src/main/resources/case/dal/analyze-table.xml
@@ -18,4 +18,6 @@
<sql-parser-test-cases>
<common sql-case-id="analyze_table_doris" />
+ <common sql-case-id="analyze_table_with_sample_percent" />
+ <common sql-case-id="analyze_table_with_sample_rows" />
</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/case/dal/create.xml
b/test/it/parser/src/main/resources/case/dal/create.xml
index 0c8118395e7..1e434297465 100644
--- a/test/it/parser/src/main/resources/case/dal/create.xml
+++ b/test/it/parser/src/main/resources/case/dal/create.xml
@@ -61,4 +61,18 @@
<repository-name name="backup_repo" start-index="28" stop-index="38" />
<property key="hadoop.username" value="user" start-index="106"
stop-index="129" />
</create-repository>
+ <create-workload-group sql-case-id="create_workload_group">
+ <group-name start-index="22" stop-index="23">g1</group-name>
+ <property key="max_cpu_percent" value="10%" start-index="36"
stop-index="58" />
+ <property key="max_memory_percent" value="30%" start-index="60"
stop-index="85" />
+ </create-workload-group>
+ <create-workload-group sql-case-id="create_workload_group_if_not_exists">
+ <group-name start-index="36" stop-index="37">g1</group-name>
+ <property key="max_cpu_percent" value="10%" start-index="50"
stop-index="72" />
+ <property key="max_memory_percent" value="30%" start-index="74"
stop-index="99" />
+ </create-workload-group>
+ <create-workload-group
sql-case-id="create_workload_group_with_keyword_group_name">
+ <group-name start-index="22" stop-index="27">sample</group-name>
+ <property key="max_cpu_percent" value="10%" start-index="40"
stop-index="62" />
+ </create-workload-group>
</sql-parser-test-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/dal/analyze-table.xml
b/test/it/parser/src/main/resources/sql/supported/dal/analyze-table.xml
index 793a90c6c46..86a925a69dc 100644
--- a/test/it/parser/src/main/resources/sql/supported/dal/analyze-table.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dal/analyze-table.xml
@@ -18,4 +18,6 @@
<sql-cases>
<sql-case id="analyze_table_doris" value="ANALYZE TABLE t_order"
db-types="Doris" />
+ <sql-case id="analyze_table_with_sample_percent" value="ANALYZE TABLE
lineitem WITH SAMPLE PERCENT 10" db-types="Doris" />
+ <sql-case id="analyze_table_with_sample_rows" value="ANALYZE TABLE
lineitem WITH SAMPLE ROWS 100000" db-types="Doris" />
</sql-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dal/create.xml
b/test/it/parser/src/main/resources/sql/supported/dal/create.xml
index f276cec08fb..17f70ab0140 100644
--- a/test/it/parser/src/main/resources/sql/supported/dal/create.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dal/create.xml
@@ -26,4 +26,7 @@
<sql-case id="create_sql_block_rule_mixed_properties" value="CREATE
SQL_BLOCK_RULE complex_rule
PROPERTIES("sql"="\\s*select\\s*\\*\\s*from
order_\\w*\\s*","global"="false","enable"="true")"
db-types="Doris" />
<sql-case id="create_repository" value="CREATE REPOSITORY `s3_repo` WITH
S3 ON LOCATION "s3://s3-repo"
PROPERTIES("s3.endpoint"="http://s3-REGION.amazonaws.com","s3.access_key"="AWS_ACCESS_KEY","s3.secret_key"="AWS_SECRET_KEY","s3.region"="REGION")"
db-types="Doris" />
<sql-case id="create_repository_readonly" value="CREATE READ ONLY
REPOSITORY backup_repo WITH HDFS ON LOCATION
"hdfs://hdfs-server:9000/backup"
PROPERTIES("hadoop.username"="user")" db-types="Doris" />
+ <sql-case id="create_workload_group" value="CREATE WORKLOAD GROUP g1
PROPERTIES("max_cpu_percent"="10%","max_memory_percent"="30%")"
db-types="Doris" />
+ <sql-case id="create_workload_group_if_not_exists" value="CREATE WORKLOAD
GROUP IF NOT EXISTS g1
PROPERTIES("max_cpu_percent"="10%","max_memory_percent"="30%")"
db-types="Doris" />
+ <sql-case id="create_workload_group_with_keyword_group_name" value="CREATE
WORKLOAD GROUP sample PROPERTIES("max_cpu_percent"="10%")"
db-types="Doris" />
</sql-cases>