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 52f109a56b3 Support MySQL Function statement parse - part2 (#38219)
52f109a56b3 is described below
commit 52f109a56b3b42620242b3f1e33d31a40ab15805
Author: Claire <[email protected]>
AuthorDate: Fri Feb 27 10:24:05 2026 +0800
Support MySQL Function statement parse - part2 (#38219)
* funtion adapt
* update release
* update release
* update release
* update
* update
---
RELEASE-NOTES.md | 5 +-
.../segment/expression/ExpressionAssert.java | 1 +
.../parser/src/main/resources/case/dml/select.xml | 112 +++++++++++++++++++++
.../main/resources/sql/supported/dml/select.xml | 8 ++
4 files changed, 125 insertions(+), 1 deletion(-)
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index fb6f58ba6a9..ded87d1f4c8 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -5,6 +5,10 @@
1. SQL Parser: Preserve unary NOT as NotExpression for scalar-subquery table
extraction in PostgreSQL -
[#38187](https://github.com/apache/shardingsphere/pull/38187)
1. JDBC: Fix stale generated values leaking into prepared statement
executeBatch calls without pending batches -
[#38160](https://github.com/apache/shardingsphere/pull/38160)
+### Enhancements
+
+1. SQL Parser: Support MySQL Function statement parse -
[#38182](https://github.com/apache/shardingsphere/pull/38182)
[#38219](https://github.com/apache/shardingsphere/pull/38219)
+
## Release 5.5.3
### CVE
@@ -55,7 +59,6 @@
1. SQL Parser: Support to parse more SQL statements for Hive -
[#36694](https://github.com/apache/shardingsphere/pull/36694)
[#37074](https://github.com/apache/shardingsphere/pull/37074)
1. SQL Parser: Support to parse CREATE MATERIALIZED VIEW for Doris -
[#31499](https://github.com/apache/shardingsphere/pull/31499)
1. SQL Parser: Support to parse CREATE FUNCTION with $$ symbol for PostgreSQL
and openGauss - [#35947](https://github.com/apache/shardingsphere/pull/35947)
-1. SQL Parser: Support MySQL Function statement parse -
[#38182](https://github.com/apache/shardingsphere/pull/38182)
1. SQL Parser: Support Oracle SQL parser correctly extract REGEXP_SUBSTR
parameters - [#37924](https://github.com/apache/shardingsphere/pull/37924)
1. SQL Parser: Fix escape '\' in SQL causing DialectSQLParsingException -
[#37943](https://github.com/apache/shardingsphere/pull/37943)
1. SQL Parser: Fix error parsing \l command SQL statement when front-end
protocol is og - [#37953](https://github.com/apache/shardingsphere/pull/37953)
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/expression/ExpressionAssert.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/expression/ExpressionAssert.java
index ebfe0e41549..7988e7694a7 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/expression/ExpressionAssert.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/expression/ExpressionAssert.java
@@ -408,6 +408,7 @@ public final class ExpressionAssert {
assertNull(actual, assertContext.getText("Variable segment should
not exist."));
return;
}
+ SQLSegmentAssert.assertIs(assertContext, actual, expected);
assertThat(assertContext.getText("Actual scope is different with
expected scope."), actual.getScope().orElse(null), is(expected.getScope()));
assertThat(assertContext.getText("Actual variable is different with
expected variable."), actual.getVariable(), is(expected.getVariable()));
}
diff --git a/test/it/parser/src/main/resources/case/dml/select.xml
b/test/it/parser/src/main/resources/case/dml/select.xml
index 5356eaa8771..e586f4a4b8f 100644
--- a/test/it/parser/src/main/resources/case/dml/select.xml
+++ b/test/it/parser/src/main/resources/case/dml/select.xml
@@ -14228,4 +14228,116 @@
</expression-projection>
</projections>
</select>
+
+ <select sql-case-id="select_mbrcontains">
+ <projections start-index="7" stop-index="27">
+ <expression-projection text="MBRContains(@g1, @g2)"
start-index="7" stop-index="27">
+ <expr>
+ <function function-name="MBRContains" start-index="7"
stop-index="27" text="MBRContains(@g1, @g2)">
+ <parameter><variable-segment start-index="19"
stop-index="21" variable="g1" /></parameter>
+ <parameter><variable-segment start-index="24"
stop-index="26" variable="g2" /></parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mbrcovers_mbrcoveredby">
+ <projections start-index="7" stop-index="47">
+ <expression-projection text="MBRCovers(@g1,@g2)" start-index="7"
stop-index="24">
+ <expr>
+ <function function-name="MBRCovers" start-index="7"
stop-index="24" text="MBRCovers(@g1,@g2)">
+ <parameter><variable-segment start-index="17"
stop-index="19" variable="g1" /></parameter>
+ <parameter><variable-segment start-index="21"
stop-index="23" variable="g2" /></parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ <expression-projection text="MBRCoveredby(@g1,@g2)"
start-index="27" stop-index="47">
+ <expr>
+ <function function-name="MBRCoveredby" start-index="27"
stop-index="47" text="MBRCoveredby(@g1,@g2)">
+ <parameter><variable-segment start-index="40"
stop-index="42" variable="g1" /></parameter>
+ <parameter><variable-segment start-index="44"
stop-index="46" variable="g2" /></parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mbrdisjoint">
+ <projections start-index="7" stop-index="27">
+ <expression-projection text="MBRDisjoint(@g1, @g4)"
start-index="7" stop-index="27">
+ <expr>
+ <function function-name="MBRDisjoint" start-index="7"
stop-index="27" text="MBRDisjoint(@g1, @g4)">
+ <parameter><variable-segment start-index="19"
stop-index="21" variable="g1" /></parameter>
+ <parameter><variable-segment start-index="24"
stop-index="26" variable="g4" /></parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mbrequals">
+ <projections start-index="7" stop-index="25">
+ <expression-projection text="MBREquals(@g1, @g1)" start-index="7"
stop-index="25">
+ <expr>
+ <function function-name="MBREquals" start-index="7"
stop-index="25" text="MBREquals(@g1, @g1)">
+ <parameter><variable-segment start-index="17"
stop-index="19" variable="g1" /></parameter>
+ <parameter><variable-segment start-index="22"
stop-index="24" variable="g1" /></parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mbrintersects">
+ <projections start-index="7" stop-index="29">
+ <expression-projection text="MBRIntersects(@g1, @g1)"
start-index="7" stop-index="29">
+ <expr>
+ <function function-name="MBRIntersects" start-index="7"
stop-index="29" text="MBRIntersects(@g1, @g1)">
+ <parameter><variable-segment start-index="21"
stop-index="23" variable="g1" /></parameter>
+ <parameter><variable-segment start-index="26"
stop-index="28" variable="g1" /></parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mbroverlaps">
+ <projections start-index="7" stop-index="27">
+ <expression-projection text="MBROverlaps(@g1, @g2)"
start-index="7" stop-index="27">
+ <expr>
+ <function function-name="MBROverlaps" start-index="7"
stop-index="27" text="MBROverlaps(@g1, @g2)">
+ <parameter><variable-segment start-index="19"
stop-index="21" variable="g1" /></parameter>
+ <parameter><variable-segment start-index="24"
stop-index="26" variable="g2" /></parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mbrtouches">
+ <projections start-index="7" stop-index="26">
+ <expression-projection text="MBRTouches(@g1, @g2)" start-index="7"
stop-index="26">
+ <expr>
+ <function function-name="MBRTouches" start-index="7"
stop-index="26" text="MBRTouches(@g1, @g2)">
+ <parameter><variable-segment start-index="18"
stop-index="20" variable="g1" /></parameter>
+ <parameter><variable-segment start-index="23"
stop-index="25" variable="g2" /></parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_mbrwithin">
+ <projections start-index="7" stop-index="25">
+ <expression-projection text="MBRWithin(@g1, @g2)" start-index="7"
stop-index="25">
+ <expr>
+ <function function-name="MBRWithin" start-index="7"
stop-index="25" text="MBRWithin(@g1, @g2)">
+ <parameter><variable-segment start-index="17"
stop-index="19" variable="g1" /></parameter>
+ <parameter><variable-segment start-index="22"
stop-index="24" variable="g2" /></parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dml/select.xml
b/test/it/parser/src/main/resources/sql/supported/dml/select.xml
index 2f7ff303a4f..8ccaca5424c 100644
--- a/test/it/parser/src/main/resources/sql/supported/dml/select.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dml/select.xml
@@ -525,4 +525,12 @@
<sql-case id="select_makedate_function" value="SELECT MAKEDATE(2011,31),
MAKEDATE(2011,32)" db-types="MySQL" />
<sql-case id="select_maketime_function" value="SELECT MAKETIME(12,15,30)"
db-types="MySQL" />
<sql-case id="select_source_pos_wait_function" value="SELECT
SOURCE_POS_WAIT('mysql-bin.000001', 100), SOURCE_POS_WAIT('bin.002', 200, 5)"
db-types="MySQL" />
+ <sql-case id="select_mbrcontains" value="SELECT MBRContains(@g1, @g2)"
db-types="MySQL" />
+ <sql-case id="select_mbrcovers_mbrcoveredby" value="SELECT
MBRCovers(@g1,@g2), MBRCoveredby(@g1,@g2)" db-types="MySQL" />
+ <sql-case id="select_mbrdisjoint" value="SELECT MBRDisjoint(@g1, @g4)"
db-types="MySQL" />
+ <sql-case id="select_mbrequals" value="SELECT MBREquals(@g1, @g1)"
db-types="MySQL" />
+ <sql-case id="select_mbrintersects" value="SELECT MBRIntersects(@g1, @g1)"
db-types="MySQL" />
+ <sql-case id="select_mbroverlaps" value="SELECT MBROverlaps(@g1, @g2)"
db-types="MySQL" />
+ <sql-case id="select_mbrtouches" value="SELECT MBRTouches(@g1, @g2)"
db-types="MySQL" />
+ <sql-case id="select_mbrwithin" value="SELECT MBRWithin(@g1, @g2)"
db-types="MySQL" />
</sql-cases>