This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 f95e912 support parse MYSQL delimiter (#14176)
f95e912 is described below
commit f95e912e2850b60c0c7e74e8dca039bc95abf04c
Author: liguoping <[email protected]>
AuthorDate: Tue Dec 21 10:57:07 2021 +0800
support parse MYSQL delimiter (#14176)
* delimiter
* remove delimiter in unsupported.xml
* sql visit rule
---
.../src/main/antlr4/imports/mysql/BaseRule.g4 | 4 ++
.../src/main/antlr4/imports/mysql/DALStatement.g4 | 4 ++
.../src/main/antlr4/imports/mysql/Keyword.g4 | 4 ++
.../sql/parser/autogen/MySQLStatement.g4 | 1 +
.../impl/MySQLDALStatementSQLVisitor.java | 9 +++++
.../core/database/visitor/SQLVisitorRule.java | 2 +
.../mysql/dal/MySQLDelimiterStatement.java | 36 +++++++++++++++++
.../asserts/statement/dal/DALStatementAssert.java | 11 ++++--
.../dal/impl/MySQLDelimiterStatementAssert.java | 45 ++++++++++++++++++++++
.../jaxb/cases/domain/SQLParserTestCases.java | 5 +++
.../statement/dal/DelimiterStatementTestCase.java | 33 ++++++++++++++++
.../src/main/resources/case/dal/delimiter.xml | 21 ++++++++++
.../main/resources/sql/supported/dal/delimiter.xml | 21 ++++++++++
.../main/resources/sql/unsupported/unsupported.xml | 1 -
14 files changed, 193 insertions(+), 4 deletions(-)
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/BaseRule.g4
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/BaseRule.g4
index b6f5373..12714bd 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/BaseRule.g4
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/BaseRule.g4
@@ -642,6 +642,10 @@ constraintName
: identifier
;
+delimiterName
+ : textOrIdentifier | ('\\'. | ~('\'' | '"' | '`' | '\\'))+
+ ;
+
userIdentifierOrText
: textOrIdentifier (AT_ textOrIdentifier)?
;
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DALStatement.g4
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DALStatement.g4
index 41d7651..b0a62e3 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DALStatement.g4
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DALStatement.g4
@@ -417,6 +417,10 @@ formatName
: TRADITIONAL | JSON | TREE
;
+delimiter
+ : DELIMITER delimiterName
+ ;
+
show
: showDatabases
| showTables
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/Keyword.g4
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/Keyword.g4
index 638c243..63445ac 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/Keyword.g4
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/Keyword.g4
@@ -115,3 +115,7 @@ INNODB
REDO_LOG
: 'REDO_LOG'
;
+
+DELIMITER
+ : D E L I M I T E R
+ ;
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/MySQLStatement.g4
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/MySQLStatement.g4
index 4cdccd0..c510b0e 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/MySQLStatement.g4
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/MySQLStatement.g4
@@ -120,6 +120,7 @@ execute
| createTablespace
| alterTablespace
| dropTablespace
+ | delimiter
) (SEMI_ EOF? | EOF)
| EOF
;
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
index 68ac3d9..0f16f5f 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
@@ -37,6 +37,7 @@ import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.CloneIn
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ComponentNameContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.CreateLoadableFunctionContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.CreateResourceGroupContext;
+import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.DelimiterContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.DropResourceGroupContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ExplainContext;
import
org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.ExplainableStatementContext;
@@ -136,6 +137,7 @@ import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQ
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLCloneStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLCreateLoadableFunctionStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLCreateResourceGroupStatement;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLDelimiterStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLDropResourceGroupStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLExplainStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLFlushStatement;
@@ -982,4 +984,11 @@ public final class MySQLDALStatementSQLVisitor extends
MySQLStatementSQLVisitor
result.setGroupName(((IdentifierValue)
visit(ctx.groupName())).getValue());
return result;
}
+
+ @Override
+ public ASTNode visitDelimiter(final DelimiterContext ctx) {
+ MySQLDelimiterStatement result = new MySQLDelimiterStatement();
+ result.setDelimiterName(ctx.delimiterName().getText());
+ return result;
+ }
}
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
index a8e44d8..bb9ccd2 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
@@ -332,6 +332,8 @@ public enum SQLVisitorRule {
ALTER_RESOURCE_GROUP("AlterResourceGroup", SQLStatementType.DAL),
+ DELIMITER("Delimiter", SQLStatementType.DAL),
+
CALL("Call", SQLStatementType.DML),
CHANGE_MASTER("ChangeMaster", SQLStatementType.RL),
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLDelimiterStatement.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLDelimiterStatement.java
new file mode 100644
index 0000000..3754b82
--- /dev/null
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLDelimiterStatement.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import
org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
+import
org.apache.shardingsphere.sql.parser.sql.common.statement.dal.DALStatement;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.MySQLStatement;
+
+/**
+ * MySQL delimiter statement.
+ */
+@ToString
+@Getter
+@Setter
+public final class MySQLDelimiterStatement extends AbstractSQLStatement
implements DALStatement, MySQLStatement {
+
+ private String delimiterName;
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/DALStatementAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/DALStatementAssert.java
index 37b2fe3..25b44eb 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/DALStatementAssert.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/DALStatementAssert.java
@@ -26,9 +26,10 @@ import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQ
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLBinlogStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLCacheIndexStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLCheckTableStatement;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLChecksumTableStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLCloneStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLCreateResourceGroupStatement;
-import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLChecksumTableStatement;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLDelimiterStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLDropResourceGroupStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLFlushStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLInstallComponentStatement;
@@ -80,8 +81,9 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.LoadIndexInfoStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.MySQLAlterResourceGroupStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.MySQLBinlogStatementAssert;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.MySQLCreateResourceGroupStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.MySQLChecksumTableStatementAssert;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.MySQLCreateResourceGroupStatementAssert;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.MySQLDelimiterStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.MySQLDropResourceGroupStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.MySQLOptimizeTableStatementAssert;
import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.dal.impl.MySQLRepairTableStatementAssert;
@@ -122,9 +124,10 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.BinlogStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.CacheIndexStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.CheckTableStatementTestCase;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ChecksumTableStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.CloneStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.CreateResourceGroupStatementTestCase;
-import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ChecksumTableStatementTestCase;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.DelimiterStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.DropResourceGroupStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ExplainStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.FlushStatementTestCase;
@@ -277,6 +280,8 @@ public final class DALStatementAssert {
ShowCollationStatementAssert.assertIs(assertContext,
(MySQLShowCollationStatement) actual, (ShowCollationStatementTestCase)
expected);
} else if (actual instanceof MySQLShowVariablesStatement) {
ShowVariablesStatementAssert.assertIs(assertContext,
(MySQLShowVariablesStatement) actual, (ShowVariablesStatementTestCase)
expected);
+ } else if (actual instanceof MySQLDelimiterStatement) {
+ MySQLDelimiterStatementAssert.assertIs(assertContext,
(MySQLDelimiterStatement) actual, (DelimiterStatementTestCase) expected);
}
}
}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/MySQLDelimiterStatementAssert.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/MySQLDelimiterStatementAssert.java
new file mode 100644
index 0000000..8e5afdd
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/MySQLDelimiterStatementAssert.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.sql.parser.parameterized.asserts.statement.dal.impl;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLDelimiterStatement;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.DelimiterStatementTestCase;
+import org.junit.Assert;
+
+import static org.hamcrest.CoreMatchers.is;
+
+/**
+ * delimiter statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class MySQLDelimiterStatementAssert {
+
+ /**
+ * Assert delimiter index statement is correct with expected parser result.
+ *
+ * @param assertContext assert context
+ * @param actual actual delimiter statement
+ * @param expected expected delimiter statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext,
final MySQLDelimiterStatement actual, final DelimiterStatementTestCase
expected) {
+ Assert.assertThat(assertContext.getText("delimiter name assertion
error: "), actual.getDelimiterName(), is(expected.getDelimiterName()));
+ }
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
index bb2fea8..2ffe142 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
@@ -28,6 +28,7 @@ import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ChecksumTableStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.CloneStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.CreateResourceGroupStatementTestCase;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.DelimiterStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.DropResourceGroupStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.ExplainStatementTestCase;
import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.dal.FlushStatementTestCase;
@@ -868,6 +869,9 @@ public final class SQLParserTestCases {
@XmlElement(name = "show-variables")
private final List<ShowVariablesStatementTestCase>
showVariablesStatementTestCases = new LinkedList<>();
+ @XmlElement(name = "delimiter")
+ private final List<DelimiterStatementTestCase> delimiterStatementTestCases
= new LinkedList<>();
+
/**
* Get all SQL parser test cases.
*
@@ -1084,6 +1088,7 @@ public final class SQLParserTestCases {
putAll(showCharacterSetStatementTestCases, result);
putAll(showCollationStatementTestCases, result);
putAll(showVariablesStatementTestCases, result);
+ putAll(delimiterStatementTestCases, result);
return result;
}
// CHECKSTYLE:ON
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/DelimiterStatementTestCase.java
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/DelimiterStatementTestCase.java
new file mode 100644
index 0000000..e41c893
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/DelimiterStatementTestCase.java
@@ -0,0 +1,33 @@
+/*
+ * 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.sql.parser.parameterized.jaxb.cases.domain.statement.dal;
+
+import lombok.Getter;
+import
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * delimiter statement test case.
+ */
+@Getter
+public final class DelimiterStatementTestCase extends SQLParserTestCase {
+
+ @XmlAttribute
+ private String delimiterName;
+}
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/delimiter.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/delimiter.xml
new file mode 100644
index 0000000..a9fa5e5
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/delimiter.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-parser-test-cases>
+ <delimiter sql-case-id="delimiter" delimiterName="|"/>
+</sql-parser-test-cases>
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dal/delimiter.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dal/delimiter.xml
new file mode 100644
index 0000000..940d1ae
--- /dev/null
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/dal/delimiter.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="delimiter" value="DELIMITER |" db-types="MySQL" />
+</sql-cases>
diff --git
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml
index f5ccdf4..ea710b8 100644
---
a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml
+++
b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/unsupported/unsupported.xml
@@ -32,7 +32,6 @@
<sql-case id="select_with_comment8" value="select 4 as expected, /*!99998
1 + /*!01000 8 + */ 2 + */ 4 as result;" db-types="MySQL"/>
<sql-case id="select_with_comment9" value="select 7 as expected, /*!01000
1 + /*!01000 8 + /*!01000 error */ 16 + */ 2 + */ 4 as result;"
db-types="MySQL"/>
<sql-case id="select_with_comment10" value="select 4 as expected, /* 1 +
/*!01000 8 + */ 2 + */ 4;" db-types="MySQL"/>
- <sql-case id="delimiter" value="DELIMITER |;" db-types="MySQL"/>
<sql-case id="with_select" value="WITH cte AS (SELECT 0 /*! ) */ SELECT *
FROM cte a, cte b;" db-types="MySQL"/>
<sql-case id="with_select_comment" value="WITH cte AS /*! ( */ SELECT 0)
SELECT * FROM cte a, cte b;" db-types="MySQL"/>
<sql-case id="select_cast" value="SELECT cast( NULL AT TIME ZONE 'UTC' AS
DATETIME );" db-types="MySQL"/>