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 ffa1b591112 Support for the ALTER RESOURCE statement (#37392)
ffa1b591112 is described below
commit ffa1b591112a8df0815b85fc37d7939c5f9f17f1
Author: cxy <[email protected]>
AuthorDate: Tue Dec 16 13:30:16 2025 +0800
Support for the ALTER RESOURCE statement (#37392)
* Support for the ALTER RESOURCE statement
* Support for the ALTER RESOURCE statement
* Support for the ALTER RESOURCE statement
---
.../core/database/visitor/SQLVisitorRule.java | 2 +
parser/sql/engine/dialect/doris/pom.xml | 5 ++
.../src/main/antlr4/imports/doris/DALStatement.g4 | 24 +++++++
.../sql/parser/autogen/DorisStatement.g4 | 1 +
.../statement/type/DorisDALStatementVisitor.java | 75 ++++++++++++++++++++++
parser/sql/statement/dialect/{ => doris}/pom.xml | 19 +++---
.../doris/dal/DorisAlterResourceStatement.java | 41 ++++++++++++
parser/sql/statement/dialect/pom.xml | 1 +
.../asserts/statement/dal/DALStatementAssert.java | 2 +
.../doris/DorisDALStatementAssert.java} | 20 +++---
.../type/DorisAlterResourceStatementAssert.java | 57 ++++++++++++++++
.../cases/parser/jaxb/RootSQLParserTestCases.java | 4 ++
.../doris/DorisAlterResourceStatementTestCase.java | 43 +++++++++++++
.../dal/dialect/doris/PropertyTestCase.java | 40 ++++++++++++
.../parser/src/main/resources/case/dal/alter.xml | 31 +++++++++
.../src/main/resources/sql/supported/dal/alter.xml | 7 ++
16 files changed, 351 insertions(+), 21 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 a9a7f8dbb87..99162f1e29e 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
@@ -473,6 +473,8 @@ public enum SQLVisitorRule {
ALTER_RESOURCE_GROUP("AlterResourceGroup", SQLStatementType.DAL),
+ ALTER_RESOURCE("AlterResource", SQLStatementType.DAL),
+
DELIMITER("Delimiter", SQLStatementType.DAL),
CALL("Call", SQLStatementType.DML),
diff --git a/parser/sql/engine/dialect/doris/pom.xml
b/parser/sql/engine/dialect/doris/pom.xml
index 271507567e3..99db7b40e92 100644
--- a/parser/sql/engine/dialect/doris/pom.xml
+++ b/parser/sql/engine/dialect/doris/pom.xml
@@ -41,5 +41,10 @@
<artifactId>shardingsphere-parser-sql-statement-mysql</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-parser-sql-statement-doris</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
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 5bc5062c33c..4aa436fbba3 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
@@ -329,6 +329,30 @@ alterResourceGroup
(ENABLE | DISABLE FORCE?)?
;
+alterResource
+ : ALTER RESOURCE resourceName PROPERTIES LP_ propertyAssignments RP_
+ ;
+
+resourceName
+ : identifier | string_
+ ;
+
+propertyAssignments
+ : propertyAssignment (COMMA_ propertyAssignment)*
+ ;
+
+propertyAssignment
+ : propertyKey EQ_ propertyValue
+ ;
+
+propertyKey
+ : identifier | string_
+ ;
+
+propertyValue
+ : literals | identifier
+ ;
+
vcpuSpec
: NUMBER_ | NUMBER_ MINUS_ NUMBER_
;
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 70f5965ed6d..b41b1ebe08d 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
@@ -51,6 +51,7 @@ execute
| createTrigger
| dropTrigger
| alterResourceGroup
+ | alterResource
| createResourceGroup
| dropResourceGroup
| prepare
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 776d14ab068..0e325acfe93 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
@@ -120,6 +120,11 @@ import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.TablesO
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.UninstallComponentContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.UninstallPluginContext;
import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.UseContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.AlterResourceContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertyAssignmentContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.ResourceNameContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertyKeyContext;
+import
org.apache.shardingsphere.sql.parser.autogen.DorisStatementParser.PropertyValueContext;
import
org.apache.shardingsphere.sql.parser.engine.doris.visitor.statement.DorisStatementVisitor;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dal.CacheTableIndexSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dal.CloneActionSegment;
@@ -153,6 +158,13 @@ import
org.apache.shardingsphere.sql.parser.statement.core.value.collection.Coll
import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
import
org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.NumberLiteralValue;
import
org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.StringLiteralValue;
+import
org.apache.shardingsphere.sql.parser.statement.core.value.literal.LiteralValue;
+import
org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.BooleanLiteralValue;
+import
org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.DateTimeLiteralValue;
+import
org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.NullLiteralValue;
+import
org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.OtherLiteralValue;
+import
org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.TemporalLiteralValue;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAlterResourceStatement;
import
org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLCloneStatement;
import
org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLCreateLoadableFunctionStatement;
import
org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLDelimiterStatement;
@@ -233,6 +245,7 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
+import java.util.Properties;
import java.util.stream.Collectors;
/**
@@ -902,6 +915,68 @@ public final class DorisDALStatementVisitor extends
DorisStatementVisitor implem
return new MySQLAlterResourceGroupStatement(getDatabaseType(),
((IdentifierValue) visit(ctx.groupName())).getValue());
}
+ @Override
+ public ASTNode visitAlterResource(final AlterResourceContext ctx) {
+ String resourceName = getResourceName(ctx.resourceName());
+ Properties properties = new Properties();
+ for (PropertyAssignmentContext each :
ctx.propertyAssignments().propertyAssignment()) {
+ String key = getPropertyKey(each.propertyKey());
+ String value = getPropertyValue(each.propertyValue());
+ properties.setProperty(key, value);
+ }
+ return new DorisAlterResourceStatement(getDatabaseType(),
resourceName, properties);
+ }
+
+ private String getResourceName(final ResourceNameContext ctx) {
+ if (null != ctx.identifier()) {
+ return ((IdentifierValue) visit(ctx.identifier())).getValue();
+ }
+ return ((StringLiteralValue) visit(ctx.string_())).getValue();
+ }
+
+ private String getPropertyKey(final PropertyKeyContext ctx) {
+ if (null != ctx.identifier()) {
+ return ((IdentifierValue) visit(ctx.identifier())).getValue();
+ }
+ return ((StringLiteralValue) visit(ctx.string_())).getValue();
+ }
+
+ private String getPropertyValue(final PropertyValueContext ctx) {
+ if (null != ctx.identifier()) {
+ return ((IdentifierValue) visit(ctx.identifier())).getValue();
+ }
+ ASTNode result = visit(ctx.literals());
+ if (result instanceof LiteralValue) {
+ return getLiteralValueAsString((LiteralValue<?>) result);
+ }
+ return result.toString();
+ }
+
+ private String getLiteralValueAsString(final LiteralValue<?> literalValue)
{
+ if (literalValue instanceof StringLiteralValue) {
+ return ((StringLiteralValue) literalValue).getValue();
+ }
+ if (literalValue instanceof NumberLiteralValue) {
+ return ((NumberLiteralValue) literalValue).getValue().toString();
+ }
+ if (literalValue instanceof BooleanLiteralValue) {
+ return String.valueOf(((BooleanLiteralValue)
literalValue).getValue());
+ }
+ if (literalValue instanceof NullLiteralValue) {
+ return "NULL";
+ }
+ if (literalValue instanceof DateTimeLiteralValue) {
+ return ((DateTimeLiteralValue) literalValue).getValue();
+ }
+ if (literalValue instanceof TemporalLiteralValue) {
+ return ((TemporalLiteralValue) literalValue).getValue();
+ }
+ if (literalValue instanceof OtherLiteralValue) {
+ return String.valueOf(((OtherLiteralValue)
literalValue).getValue());
+ }
+ return String.valueOf(literalValue.getValue());
+ }
+
@Override
public ASTNode visitChangeMasterTo(final ChangeMasterToContext ctx) {
return new MySQLChangeMasterStatement(getDatabaseType());
diff --git a/parser/sql/statement/dialect/pom.xml
b/parser/sql/statement/dialect/doris/pom.xml
similarity index 75%
copy from parser/sql/statement/dialect/pom.xml
copy to parser/sql/statement/dialect/doris/pom.xml
index 42dda4bd6fe..5560276e84f 100644
--- a/parser/sql/statement/dialect/pom.xml
+++ b/parser/sql/statement/dialect/doris/pom.xml
@@ -20,18 +20,17 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-parser-sql-statement</artifactId>
+ <artifactId>shardingsphere-parser-sql-statement-dialect</artifactId>
<version>5.5.3-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-parser-sql-statement-dialect</artifactId>
- <packaging>pom</packaging>
+ <artifactId>shardingsphere-parser-sql-statement-doris</artifactId>
<name>${project.artifactId}</name>
- <modules>
- <module>postgresql</module>
- <module>mysql</module>
- <module>sqlserver</module>
- <module>oracle</module>
- <module>hive</module>
- </modules>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-parser-sql-statement-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
diff --git
a/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisAlterResourceStatement.java
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisAlterResourceStatement.java
new file mode 100644
index 00000000000..14e4586d934
--- /dev/null
+++
b/parser/sql/statement/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisAlterResourceStatement.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.dal;
+
+import lombok.Getter;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.DALStatement;
+
+import java.util.Properties;
+
+/**
+ * Alter resource statement for Doris.
+ */
+@Getter
+public final class DorisAlterResourceStatement extends DALStatement {
+
+ private final String resourceName;
+
+ private final Properties properties;
+
+ public DorisAlterResourceStatement(final DatabaseType databaseType, final
String resourceName, final Properties properties) {
+ super(databaseType);
+ this.resourceName = resourceName;
+ this.properties = properties;
+ }
+}
diff --git a/parser/sql/statement/dialect/pom.xml
b/parser/sql/statement/dialect/pom.xml
index 42dda4bd6fe..1e1dab49f1e 100644
--- a/parser/sql/statement/dialect/pom.xml
+++ b/parser/sql/statement/dialect/pom.xml
@@ -33,5 +33,6 @@
<module>sqlserver</module>
<module>oracle</module>
<module>hive</module>
+ <module>doris</module>
</modules>
</project>
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/DALStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/DALStatementAssert.java
index d9ca26e2e29..ba9aca8f87f 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/DALStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/DALStatementAssert.java
@@ -24,6 +24,7 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAsse
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.mysql.MySQLDALStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.oracle.OracleDALStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.postgresql.PostgreSQLDALStatementAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.DorisDALStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.standard.StandardDALStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase;
@@ -45,5 +46,6 @@ public final class DALStatementAssert {
MySQLDALStatementAssert.assertIs(assertContext, actual, expected);
PostgreSQLDALStatementAssert.assertIs(assertContext, actual, expected);
OracleDALStatementAssert.assertIs(assertContext, actual, expected);
+ DorisDALStatementAssert.assertIs(assertContext, actual, expected);
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/DALStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java
similarity index 67%
copy from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/DALStatementAssert.java
copy to
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java
index d9ca26e2e29..23c4bd3799a 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/DALStatementAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/DorisDALStatementAssert.java
@@ -15,23 +15,22 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal;
+package
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.DALStatement;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAlterResourceStatement;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
-import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.mysql.MySQLDALStatementAssert;
-import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.oracle.OracleDALStatementAssert;
-import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.postgresql.PostgreSQLDALStatementAssert;
-import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.standard.StandardDALStatementAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisAlterResourceStatementAssert;
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.dal.dialect.doris.DorisAlterResourceStatementTestCase;
/**
- * DAL statement assert.
+ * DAL statement assert for Doris.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class DALStatementAssert {
+public final class DorisDALStatementAssert {
/**
* Assert DAL statement is correct with expected parser result.
@@ -41,9 +40,8 @@ public final class DALStatementAssert {
* @param expected expected DAL statement test case
*/
public static void assertIs(final SQLCaseAssertContext assertContext,
final DALStatement actual, final SQLParserTestCase expected) {
- StandardDALStatementAssert.assertIs(assertContext, actual, expected);
- MySQLDALStatementAssert.assertIs(assertContext, actual, expected);
- PostgreSQLDALStatementAssert.assertIs(assertContext, actual, expected);
- OracleDALStatementAssert.assertIs(assertContext, actual, expected);
+ if (actual instanceof DorisAlterResourceStatement) {
+ DorisAlterResourceStatementAssert.assertIs(assertContext,
(DorisAlterResourceStatement) actual, (DorisAlterResourceStatementTestCase)
expected);
+ }
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisAlterResourceStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisAlterResourceStatementAssert.java
new file mode 100644
index 00000000000..b121c7b605a
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisAlterResourceStatementAssert.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAlterResourceStatement;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAlterResourceStatementTestCase;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+/**
+ * Alter resource statement assert for Doris.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DorisAlterResourceStatementAssert {
+
+ /**
+ * Assert alter resource statement is correct with expected parser result.
+ *
+ * @param assertContext assert context
+ * @param actual actual alter resource statement
+ * @param expected expected alter resource statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final DorisAlterResourceStatement actual, final
DorisAlterResourceStatementTestCase expected) {
+ if (null != expected.getResourceName()) {
+ assertThat(assertContext.getText("resource name does not match:
"), actual.getResourceName(), is(expected.getResourceName()));
+ }
+ assertNotNull(actual.getProperties(),
assertContext.getText("properties should not be null"));
+ if (!expected.getProperties().isEmpty()) {
+ assertThat(assertContext.getText("properties size does not match:
"), actual.getProperties().size(), is(expected.getProperties().size()));
+ expected.getProperties().forEach(property -> {
+ String actualValue =
actual.getProperties().getProperty(property.getKey());
+ assertNotNull(actualValue, assertContext.getText("property key
'" + property.getKey() + "' should exist"));
+ assertThat(assertContext.getText("property value for key '" +
property.getKey() + "' does not match: "), actualValue,
is(property.getValue()));
+ });
+ }
+ }
+}
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 acbe5468e9d..e76a915e849 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
@@ -72,6 +72,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.mysql.table.MySQLChecksumTableStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.mysql.table.MySQLOptimizeTableStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.mysql.table.MySQLRepairTableStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAlterResourceStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.oracle.OracleSpoolStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.postgresql.PostgreSQLResetParameterStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.standard.EmptyStatementTestCase;
@@ -649,6 +650,9 @@ public final class RootSQLParserTestCases {
@XmlElement(name = "alter-resource-group")
private final List<MySQLAlterResourceGroupStatementTestCase>
alterResourceGroupTestCases = new LinkedList<>();
+ @XmlElement(name = "alter-resource")
+ private final List<DorisAlterResourceStatementTestCase>
alterResourceTestCases = new LinkedList<>();
+
@XmlElement(name = "create-resource-group")
private final List<MySQLCreateResourceGroupStatementTestCase>
createResourceGroupTestCases = 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/DorisAlterResourceStatementTestCase.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisAlterResourceStatementTestCase.java
new file mode 100644
index 00000000000..4c7fe43506c
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisAlterResourceStatementTestCase.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;
+
+/**
+ * Alter resource statement test case for Doris.
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@Getter
+@Setter
+public final class DorisAlterResourceStatementTestCase extends
SQLParserTestCase {
+
+ @XmlElement(name = "resource-name")
+ private String resourceName;
+
+ @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/PropertyTestCase.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/PropertyTestCase.java
new file mode 100644
index 00000000000..b0a27509ca6
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/PropertyTestCase.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.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * Property test case for Doris.
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@Getter
+@Setter
+public final class PropertyTestCase {
+
+ @XmlAttribute
+ private String key;
+
+ @XmlAttribute
+ private String value;
+}
diff --git a/test/it/parser/src/main/resources/case/dal/alter.xml
b/test/it/parser/src/main/resources/case/dal/alter.xml
index 87f9a332d2e..13f0c9bbfb8 100644
--- a/test/it/parser/src/main/resources/case/dal/alter.xml
+++ b/test/it/parser/src/main/resources/case/dal/alter.xml
@@ -22,4 +22,35 @@
</alter-resource-group>
<alter-resource-group sql-case-id="alter_resource_cost_cpu_time" />
<alter-resource-group sql-case-id="alter_resource_cost_cpu" />
+ <alter-resource sql-case-id="alter_resource_properties">
+ <resource-name start-index="15"
stop-index="25">remote_s3</resource-name>
+ <property key="s3.connection.maximum" value="100" />
+ </alter-resource>
+ <alter-resource sql-case-id="alter_resource_with_identifier">
+ <resource-name start-index="15"
stop-index="23">remote_s3</resource-name>
+ <property key="s3.connection.maximum" value="100" />
+ </alter-resource>
+ <alter-resource sql-case-id="alter_resource_with_number">
+ <resource-name start-index="15"
stop-index="25">remote_s3</resource-name>
+ <property key="s3.connection.timeout" value="1000" />
+ </alter-resource>
+ <alter-resource sql-case-id="alter_resource_multiple_properties">
+ <resource-name start-index="15"
stop-index="25">remote_s3</resource-name>
+ <property key="s3.connection.maximum" value="100" />
+ <property key="s3.connection.timeout" value="1000" />
+ </alter-resource>
+ <alter-resource sql-case-id="alter_resource_with_boolean">
+ <resource-name start-index="15"
stop-index="25">remote_s3</resource-name>
+ <property key="s3.use_path_style" value="true" />
+ </alter-resource>
+ <alter-resource sql-case-id="alter_resource_with_null">
+ <resource-name start-index="15"
stop-index="25">remote_s3</resource-name>
+ <property key="s3.session_token" value="NULL" />
+ </alter-resource>
+ <alter-resource sql-case-id="alter_resource_mixed_types">
+ <resource-name start-index="15"
stop-index="25">remote_s3</resource-name>
+ <property key="s3.connection.maximum" value="100" />
+ <property key="s3.connection.timeout" value="1000" />
+ <property key="s3.use_path_style" value="false" />
+ </alter-resource>
</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dal/alter.xml
b/test/it/parser/src/main/resources/sql/supported/dal/alter.xml
index 2a15133ec14..04e8be96087 100644
--- a/test/it/parser/src/main/resources/sql/supported/dal/alter.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dal/alter.xml
@@ -20,4 +20,11 @@
<sql-case id="alter_resource_group" value="ALTER RESOURCE GROUP rg"
db-types="MySQL" />
<sql-case id="alter_resource_cost_cpu_time" value="ALTER RESOURCE COST
CPU_PER_SESSION 100 CONNECT_TIME 1" db-types="Oracle" />
<sql-case id="alter_resource_cost_cpu" value="ALTER RESOURCE COST
CPU_PER_SESSION 100" db-types="Oracle" />
+ <sql-case id="alter_resource_properties" value="ALTER RESOURCE 'remote_s3'
PROPERTIES ("s3.connection.maximum" = "100");"
db-types="Doris" />
+ <sql-case id="alter_resource_with_identifier" value="ALTER RESOURCE
remote_s3 PROPERTIES (`s3.connection.maximum` = `100`);" db-types="Doris" />
+ <sql-case id="alter_resource_with_number" value="ALTER RESOURCE
'remote_s3' PROPERTIES ("s3.connection.timeout" = 1000);"
db-types="Doris" />
+ <sql-case id="alter_resource_multiple_properties" value="ALTER RESOURCE
'remote_s3' PROPERTIES ("s3.connection.maximum" = "100",
"s3.connection.timeout" = 1000);" db-types="Doris" />
+ <sql-case id="alter_resource_with_boolean" value="ALTER RESOURCE
'remote_s3' PROPERTIES ("s3.use_path_style" = true);"
db-types="Doris" />
+ <sql-case id="alter_resource_with_null" value="ALTER RESOURCE 'remote_s3'
PROPERTIES ("s3.session_token" = NULL);" db-types="Doris" />
+ <sql-case id="alter_resource_mixed_types" value="ALTER RESOURCE
'remote_s3' PROPERTIES ("s3.connection.maximum" = "100",
"s3.connection.timeout" = 1000, "s3.use_path_style" =
false);" db-types="Doris" />
</sql-cases>