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 77697387576 Support parsing Doris UNSET VARIABLE syntax (#38074)
77697387576 is described below
commit 77697387576d174e53a24178678bedf5bc46c5e8
Author: cxy <[email protected]>
AuthorDate: Wed Feb 18 17:32:35 2026 +0800
Support parsing Doris UNSET VARIABLE syntax (#38074)
* Support parsing Doris UNSET VARIABLE syntax
* Support parsing Doris UNSET VARIABLE syntax
---
.../core/database/visitor/SQLVisitorRule.java | 2 +
.../src/main/antlr4/imports/doris/BaseRule.g4 | 2 +
.../src/main/antlr4/imports/doris/DALStatement.g4 | 8 ++++
.../src/main/antlr4/imports/doris/DorisKeyword.g4 | 8 ++++
.../sql/parser/autogen/DorisStatement.g4 | 1 +
.../statement/type/DorisDALStatementVisitor.java | 9 +++++
.../statement/type/dal/UnsetVariableStatement.java | 47 ++++++++++++++++++++++
.../dal/dialect/doris/DorisDALStatementAssert.java | 5 +++
.../type/DorisUnsetVariableStatementAssert.java | 45 +++++++++++++++++++++
.../cases/parser/jaxb/RootSQLParserTestCases.java | 4 ++
.../doris/DorisUnsetVariableStatementTestCase.java | 38 +++++++++++++++++
.../parser/src/main/resources/case/dal/unset.xml | 30 ++++++++++++++
.../src/main/resources/sql/supported/dal/unset.xml | 30 ++++++++++++++
13 files changed, 229 insertions(+)
diff --git
a/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java
b/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLVisitorRule.java
index 7ef1877ec02..d7a25f219d9 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
@@ -439,6 +439,8 @@ public enum SQLVisitorRule {
SET_VARIABLE("SetVariable", SQLStatementType.DAL),
+ UNSET_VARIABLE("UnsetVariable", SQLStatementType.DAL),
+
SET("Set", SQLStatementType.DAL),
SET_NAME("SetName", SQLStatementType.DAL),
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 03805cc0bc4..55a7c2538f6 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
@@ -526,12 +526,14 @@ identifierKeywordsUnambiguous
| UNDOFILE
| UNDO_BUFFER_SIZE
| UNKNOWN
+ | UNSET
| UNTIL
| UPGRADE
| USER
| USE_FRM
| VALIDATION
| VALUE
+ | VARIABLE
| VARIABLES
| VCPU
| VERBOSE
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 accc28a1e08..dd3679cb277 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
@@ -78,6 +78,14 @@ optionValueNoOptionType
| NAMES (equal expr | charsetName collateClause? | DEFAULT)
;
+unsetVariable
+ : UNSET optionType? VARIABLE (LP_ unsetVariableName RP_ |
unsetVariableName)
+ ;
+
+unsetVariableName
+ : internalVariableName | ALL
+ ;
+
equal
: EQ_ | ASSIGNMENT_
;
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 ef7d5aaca32..41f2a477fc9 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
@@ -3002,6 +3002,10 @@ UNLOCK
: U N L O C K
;
+UNSET
+ : U N S E T
+ ;
+
UNSIGNED
: U N S I G N E D
;
@@ -3086,6 +3090,10 @@ VARCHARACTER
: V A R C H A R A C T E R
;
+VARIABLE
+ : V A R I A B L E
+ ;
+
VARIABLES
: V A R I A B L E S
;
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 c24affdad27..1b8e730ea25 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
@@ -144,6 +144,7 @@ execute
| createFile
| dropFile
| sync
+ | unsetVariable
// TODO consider refactor following sytax to SEMI_? EOF
) (SEMI_ EOF? | EOF)
| EOF
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 97526d05fbc..eb38b80b8e6 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
@@ -122,6 +122,7 @@ 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.UnsetVariableContext;
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;
@@ -180,6 +181,7 @@ import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.An
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.ExplainStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.RefreshStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.SetStatement;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.UnsetVariableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.util.SQLUtils;
import
org.apache.shardingsphere.sql.parser.statement.core.value.collection.CollectionValue;
import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
@@ -937,6 +939,13 @@ public final class DorisDALStatementVisitor extends
DorisStatementVisitor implem
return null;
}
+ @Override
+ public ASTNode visitUnsetVariable(final UnsetVariableContext ctx) {
+ String scope = null != ctx.optionType() ? ctx.optionType().getText() :
"SESSION";
+ String variableName = ctx.unsetVariableName().getText();
+ return new UnsetVariableStatement(getDatabaseType(), scope,
variableName);
+ }
+
private String getAssignValue(final OptionValueNoOptionTypeContext ctx) {
if (null != ctx.NAMES()) {
return ctx.charsetName().getText();
diff --git
a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/dal/UnsetVariableStatement.java
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/dal/UnsetVariableStatement.java
new file mode 100644
index 00000000000..f96c7cfedab
--- /dev/null
+++
b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/type/dal/UnsetVariableStatement.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal;
+
+import lombok.Getter;
+import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.attribute.SQLStatementAttributes;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.attribute.type.AllowNotUseDatabaseSQLStatementAttribute;
+
+/**
+ * Unset variable statement.
+ */
+@Getter
+public final class UnsetVariableStatement extends DALStatement {
+
+ private final String scope;
+
+ private final String variableName;
+
+ private SQLStatementAttributes attributes;
+
+ public UnsetVariableStatement(final DatabaseType databaseType, final
String scope, final String variableName) {
+ super(databaseType);
+ this.scope = scope;
+ this.variableName = variableName;
+ }
+
+ @Override
+ public void buildAttributes() {
+ attributes = new SQLStatementAttributes(new
AllowNotUseDatabaseSQLStatementAttribute(true));
+ }
+}
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 349f6670370..783e93ff304 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
@@ -20,6 +20,7 @@ package
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.DALStatement;
+import
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.UnsetVariableStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAlterResourceStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisAlterSystemStatement;
import
org.apache.shardingsphere.sql.parser.statement.doris.dal.DorisCreateSqlBlockRuleStatement;
@@ -31,11 +32,13 @@ 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.DorisCreateSqlBlockRuleStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisShowQueryStatsStatementAssert;
import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisSwitchStatementAssert;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dal.dialect.doris.type.DorisUnsetVariableStatementAssert;
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;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisAlterSystemStatementTestCase;
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.DorisSwitchStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisUnsetVariableStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.show.DorisShowQueryStatsStatementTestCase;
/**
@@ -62,6 +65,8 @@ public final class DorisDALStatementAssert {
DorisShowQueryStatsStatementAssert.assertIs(assertContext,
(DorisShowQueryStatsStatement) actual, (DorisShowQueryStatsStatementTestCase)
expected);
} else if (actual instanceof DorisSwitchStatement) {
DorisSwitchStatementAssert.assertIs(assertContext,
(DorisSwitchStatement) actual, (DorisSwitchStatementTestCase) expected);
+ } else if (actual instanceof UnsetVariableStatement) {
+ DorisUnsetVariableStatementAssert.assertIs(assertContext,
(UnsetVariableStatement) actual, (DorisUnsetVariableStatementTestCase)
expected);
}
}
}
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisUnsetVariableStatementAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisUnsetVariableStatementAssert.java
new file mode 100644
index 00000000000..ff4a34dcd11
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/statement/dal/dialect/doris/type/DorisUnsetVariableStatementAssert.java
@@ -0,0 +1,45 @@
+/*
+ * 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.statement.type.dal.UnsetVariableStatement;
+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.DorisUnsetVariableStatementTestCase;
+import org.hamcrest.CoreMatchers;
+import org.hamcrest.MatcherAssert;
+
+/**
+ * Unset variable statement assert for Doris.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class DorisUnsetVariableStatementAssert {
+
+ /**
+ * Assert unset variable statement is correct with expected parser result.
+ *
+ * @param assertContext assert context
+ * @param actual actual unset variable statement
+ * @param expected expected unset variable statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final UnsetVariableStatement actual, final DorisUnsetVariableStatementTestCase
expected) {
+ MatcherAssert.assertThat(assertContext.getText("Unset variable scope
assertion error: "), actual.getScope(), CoreMatchers.is(expected.getScope()));
+ MatcherAssert.assertThat(assertContext.getText("Unset variable name
assertion error: "), actual.getVariableName(),
CoreMatchers.is(expected.getVariableName()));
+ }
+}
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 487b55d1d9a..8abae8e85de 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
@@ -32,6 +32,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.DorisShowSqlBlockRuleStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowRoutineLoadTaskStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisShowRoutineLoadStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.doris.DorisUnsetVariableStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ddl.standard.catalog.AlterCatalogStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.tcl.HiveAbortStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.mysql.MySQLCloneStatementTestCase;
@@ -1165,6 +1166,9 @@ public final class RootSQLParserTestCases {
@XmlElement(name = "set-dist-variable")
private final List<SetDistVariableStatementTestCase>
setDistVariableTestCases = new LinkedList<>();
+ @XmlElement(name = "unset-variable")
+ private final List<DorisUnsetVariableStatementTestCase>
unsetVariableTestCases = new LinkedList<>();
+
@XmlElement(name = "create-shadow-rule")
private final List<CreateShadowRuleStatementTestCase>
createShadowRuleTestCases = 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/DorisUnsetVariableStatementTestCase.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisUnsetVariableStatementTestCase.java
new file mode 100644
index 00000000000..4d6f68ef105
--- /dev/null
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/dal/dialect/doris/DorisUnsetVariableStatementTestCase.java
@@ -0,0 +1,38 @@
+/*
+ * 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.XmlAttribute;
+
+/**
+ * Unset variable statement test case for Doris.
+ */
+@Getter
+@Setter
+public final class DorisUnsetVariableStatementTestCase extends
SQLParserTestCase {
+
+ @XmlAttribute
+ private String scope;
+
+ @XmlAttribute(name = "variable-name")
+ private String variableName;
+}
diff --git a/test/it/parser/src/main/resources/case/dal/unset.xml
b/test/it/parser/src/main/resources/case/dal/unset.xml
new file mode 100644
index 00000000000..f567d1c41b3
--- /dev/null
+++ b/test/it/parser/src/main/resources/case/dal/unset.xml
@@ -0,0 +1,30 @@
+<?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>
+ <unset-variable sql-case-id="unset_global_variable" scope="GLOBAL"
variable-name="exec_mem_limit" />
+ <unset-variable sql-case-id="unset_session_variable" scope="SESSION"
variable-name="exec_mem_limit" />
+ <unset-variable sql-case-id="unset_local_variable" scope="LOCAL"
variable-name="exec_mem_limit" />
+ <unset-variable sql-case-id="unset_variable_default_scope" scope="SESSION"
variable-name="exec_mem_limit" />
+ <unset-variable sql-case-id="unset_global_variable_all" scope="GLOBAL"
variable-name="ALL" />
+ <unset-variable
sql-case-id="unset_variable_default_scope_without_parentheses" scope="SESSION"
variable-name="time_zone" />
+ <unset-variable sql-case-id="unset_global_variable_without_parentheses"
scope="GLOBAL" variable-name="exec_mem_limit" />
+ <unset-variable sql-case-id="unset_session_variable_without_parentheses"
scope="SESSION" variable-name="exec_mem_limit" />
+ <unset-variable sql-case-id="unset_local_variable_without_parentheses"
scope="LOCAL" variable-name="exec_mem_limit" />
+ <unset-variable
sql-case-id="unset_global_variable_all_without_parentheses" scope="GLOBAL"
variable-name="ALL" />
+</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dal/unset.xml
b/test/it/parser/src/main/resources/sql/supported/dal/unset.xml
new file mode 100644
index 00000000000..4613a07a5ef
--- /dev/null
+++ b/test/it/parser/src/main/resources/sql/supported/dal/unset.xml
@@ -0,0 +1,30 @@
+<?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="unset_global_variable" value="UNSET GLOBAL VARIABLE
(exec_mem_limit)" db-types="Doris" />
+ <sql-case id="unset_session_variable" value="UNSET SESSION VARIABLE
(exec_mem_limit)" db-types="Doris" />
+ <sql-case id="unset_local_variable" value="UNSET LOCAL VARIABLE
(exec_mem_limit)" db-types="Doris" />
+ <sql-case id="unset_variable_default_scope" value="UNSET VARIABLE
(exec_mem_limit)" db-types="Doris" />
+ <sql-case id="unset_global_variable_all" value="UNSET GLOBAL VARIABLE
(ALL)" db-types="Doris" />
+ <sql-case id="unset_variable_default_scope_without_parentheses"
value="UNSET VARIABLE time_zone" db-types="Doris" />
+ <sql-case id="unset_global_variable_without_parentheses" value="UNSET
GLOBAL VARIABLE exec_mem_limit" db-types="Doris" />
+ <sql-case id="unset_session_variable_without_parentheses" value="UNSET
SESSION VARIABLE exec_mem_limit" db-types="Doris" />
+ <sql-case id="unset_local_variable_without_parentheses" value="UNSET LOCAL
VARIABLE exec_mem_limit" db-types="Doris" />
+ <sql-case id="unset_global_variable_all_without_parentheses" value="UNSET
GLOBAL VARIABLE ALL" db-types="Doris" />
+</sql-cases>