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 57537f56f52 Support parsing MySQL CREATE sql (#38237)
57537f56f52 is described below
commit 57537f56f52a492e14cbbd1a19d2e8712f7b8a0a
Author: Claire <[email protected]>
AuthorDate: Sat Feb 28 10:58:02 2026 +0800
Support parsing MySQL CREATE sql (#38237)
* add tests
* support event
* support event
---
RELEASE-NOTES.md | 1 +
.../src/main/resources/case/ddl/create-event.xml | 21 +++++++++++++++++++++
.../src/main/resources/case/ddl/create-function.xml | 4 ++++
.../resources/sql/supported/ddl/create-event.xml | 21 +++++++++++++++++++++
.../resources/sql/supported/ddl/create-function.xml | 4 ++++
5 files changed, 51 insertions(+)
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 7191eacc30c..7c9ca3c75d7 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -9,6 +9,7 @@
1. SQL Parser: Support MySQL Function statement parse -
[#38182](https://github.com/apache/shardingsphere/pull/38182)
[#38219](https://github.com/apache/shardingsphere/pull/38219)
2. SQL Parser: Support parsing MySQL SELECT sql -
[#38233](https://github.com/apache/shardingsphere/pull/38233)
+3. SQL Parser: Support parsing MySQL CREATE sql -
[#38237](https://github.com/apache/shardingsphere/pull/38237)
## Release 5.5.3
diff --git a/test/it/parser/src/main/resources/case/ddl/create-event.xml
b/test/it/parser/src/main/resources/case/ddl/create-event.xml
new file mode 100644
index 00000000000..a6332c8ce26
--- /dev/null
+++ b/test/it/parser/src/main/resources/case/ddl/create-event.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>
+ <common sql-case-id="create_event" />
+</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/case/ddl/create-function.xml
b/test/it/parser/src/main/resources/case/ddl/create-function.xml
index e6e510fc446..a492633c7c7 100644
--- a/test/it/parser/src/main/resources/case/ddl/create-function.xml
+++ b/test/it/parser/src/main/resources/case/ddl/create-function.xml
@@ -168,4 +168,8 @@
</create-function>
<create-function sql-case-id="create_function_doris_routine_body" />
<create-function
sql-case-id="create_function_doris_aggregate_intermediate" />
+ <create-function sql-case-id="create_function_gtid_is_disjoint" />
+ <create-function sql-case-id="create_function_gtid_is_disjoint_union" />
+ <create-function sql-case-id="create_function_gtid_intersection" />
+ <create-function sql-case-id="create_function_gtid_intersection_with_uuid"
/>
</sql-parser-test-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/ddl/create-event.xml
b/test/it/parser/src/main/resources/sql/supported/ddl/create-event.xml
new file mode 100644
index 00000000000..ec6b74bcd28
--- /dev/null
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/create-event.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="create_event" value="CREATE EVENT e_insert ON SCHEDULE EVERY
7 SECOND DO INSERT INTO myschema.mytable VALUES ()" db-types="MySQL" />
+</sql-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/ddl/create-function.xml
b/test/it/parser/src/main/resources/sql/supported/ddl/create-function.xml
index 3fe18b52e37..d37aff9fb6a 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/create-function.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/create-function.xml
@@ -91,4 +91,8 @@
<sql-case id="create_function_doris_with_owner" value="CREATE FUNCTION
analytics.udf_add(INT) RETURNS INT PROPERTIES
('file'='file:///path/to/lib.so','symbol'='analytics.udf.Add','type'='JAVA_UDF')"
db-types="Doris" />
<sql-case id="create_function_doris_routine_body" value="CREATE FUNCTION
udf_body(x INT) RETURNS INT BEGIN RETURN x + 1; END" db-types="Doris" />
<sql-case id="create_function_doris_aggregate_intermediate" value="CREATE
AGGREGATE FUNCTION agg_mid(INT) RETURNS INT INTERMEDIATE INT PROPERTIES
('file'='file:///pathTo/java-udaf.jar','symbol'='org.apache.doris.udf.demo.SimpleDemo','type'='JAVA_UDF')"
db-types="Doris" />
+ <sql-case id="create_function_gtid_is_disjoint" value="CREATE FUNCTION
GTID_IS_DISJOINT(gs1 LONGTEXT, gs2 LONGTEXT) RETURNS INT RETURN
GTID_SUBSET(gs1, GTID_SUBTRACT(gs1, gs2));" db-types="MySQL" />
+ <sql-case id="create_function_gtid_is_disjoint_union" value="CREATE
FUNCTION GTID_IS_DISJOINT_UNION(gs1 LONGTEXT, gs2 LONGTEXT, sum LONGTEXT)
RETURNS INT RETURN GTID_IS_EQUAL(GTID_SUBTRACT(sum, gs1), gs2) AND
GTID_IS_EQUAL(GTID_SUBTRACT(sum, gs2), gs1);" db-types="MySQL" />
+ <sql-case id="create_function_gtid_intersection" value="CREATE FUNCTION
GTID_INTERSECTION(gs1 LONGTEXT, gs2 LONGTEXT) RETURNS LONGTEXT RETURN
GTID_SUBTRACT(gs1, GTID_SUBTRACT(gs1, gs2));" db-types="MySQL" />
+ <sql-case id="create_function_gtid_intersection_with_uuid" value="CREATE
FUNCTION GTID_INTERSECTION_WITH_UUID(gs LONGTEXT, uuid TEXT) RETURNS LONGTEXT
RETURN GTID_SUBTRACT(gs, GTID_SUBTRACT_UUID(gs, uuid));" db-types="MySQL" />
</sql-cases>