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 4f0e86b1f7b Add SQL parser test cases for MySQL (#37841)
4f0e86b1f7b is described below

commit 4f0e86b1f7b8ac72a25f2341c4eabc1aa376e933
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Jan 25 23:27:03 2026 +0800

    Add SQL parser test cases for MySQL (#37841)
---
 .../main/resources/case/dml/select-expression.xml  | 56 ++++++++++++++++++++++
 .../resources/case/dml/select-special-function.xml | 24 ++++++++++
 .../parser/src/main/resources/case/dml/select.xml  | 25 ++++++++++
 .../sql/supported/dml/select-expression.xml        |  2 +
 .../sql/supported/dml/select-special-function.xml  |  2 +
 .../main/resources/sql/supported/dml/select.xml    |  2 +
 6 files changed, 111 insertions(+)

diff --git a/test/it/parser/src/main/resources/case/dml/select-expression.xml 
b/test/it/parser/src/main/resources/case/dml/select-expression.xml
index 7854b4e115b..17bc9221f2d 100644
--- a/test/it/parser/src/main/resources/case/dml/select-expression.xml
+++ b/test/it/parser/src/main/resources/case/dml/select-expression.xml
@@ -3417,4 +3417,60 @@
             </expr>
         </where>
     </select>
+
+    <select sql-case-id="select_where_with_safe_equal_parameter_mysql" 
parameters="1">
+        <from start-index="14" stop-index="20">
+            <simple-table name="t_order" start-index="14" stop-index="20" />
+        </from>
+        <projections distinct-row="false" start-index="7" stop-index="7">
+            <shorthand-projection start-index="7" stop-index="7" />
+        </projections>
+        <where start-index="22" stop-index="39">
+            <expr>
+                <binary-operation-expression start-index="28" stop-index="39">
+                    <left>
+                        <column name="status" start-index="28" stop-index="33" 
/>
+                    </left>
+                    <operator>&lt;=&gt;</operator>
+                    <right>
+                        <parameter-marker-expression parameter-index="0" 
start-index="39" stop-index="39" />
+                    </right>
+                </binary-operation-expression>
+            </expr>
+        </where>
+    </select>
+
+    <select sql-case-id="select_where_equal_all_subquery_mysql">
+        <from start-index="14" stop-index="20">
+            <simple-table name="t_order" start-index="14" stop-index="20" />
+        </from>
+        <projections distinct-row="false" start-index="7" stop-index="7">
+            <shorthand-projection start-index="7" stop-index="7" />
+        </projections>
+        <where start-index="22" stop-index="67">
+            <expr>
+                <binary-operation-expression start-index="28" stop-index="67">
+                    <left>
+                        <column name="amount" start-index="28" stop-index="33" 
/>
+                    </left>
+                    <operator>=</operator>
+                    <right>
+                        <quantify-subquery-expression>
+                            <operator>ALL</operator>
+                            <subquery start-index="41" stop-index="67">
+                                <select>
+                                    <projections distinct-row="false" 
start-index="49" stop-index="53">
+                                        <column-projection name="price" 
start-index="49" stop-index="53" />
+                                    </projections>
+                                    <from start-index="55" stop-index="66">
+                                        <simple-table name="t_price" 
start-index="60" stop-index="66" />
+                                    </from>
+                                </select>
+                            </subquery>
+                        </quantify-subquery-expression>
+                    </right>
+                </binary-operation-expression>
+            </expr>
+        </where>
+    </select>
 </sql-parser-test-cases>
diff --git 
a/test/it/parser/src/main/resources/case/dml/select-special-function.xml 
b/test/it/parser/src/main/resources/case/dml/select-special-function.xml
index 1b147a74e97..a7bfedf99b9 100644
--- a/test/it/parser/src/main/resources/case/dml/select-special-function.xml
+++ b/test/it/parser/src/main/resources/case/dml/select-special-function.xml
@@ -5580,4 +5580,28 @@
             </expression-projection>
         </projections>
     </select>
+
+    <select sql-case-id="select_current_time_precision_mysql">
+        <projections start-index="7" stop-index="21">
+            <expression-projection text="CURRENT_TIME(3)" start-index="7" 
stop-index="21">
+                <expr>
+                    <function function-name="CURRENT_TIME" start-index="7" 
stop-index="21" text="CURRENT_TIME(3)">
+                        <parameter>
+                            <literal-expression value="3" start-index="20" 
stop-index="20" />
+                        </parameter>
+                    </function>
+                </expr>
+            </expression-projection>
+        </projections>
+    </select>
+
+    <select sql-case-id="select_odbc_fn_now_mysql">
+        <projections start-index="7" stop-index="16">
+            <expression-projection text="NOW()" start-index="11" 
stop-index="15">
+                <expr>
+                    <function function-name="NOW" start-index="11" 
stop-index="15" text="NOW()" />
+                </expr>
+            </expression-projection>
+        </projections>
+    </select>
 </sql-parser-test-cases>
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 c6e32d3fbf0..6d82cfe3d4b 100644
--- a/test/it/parser/src/main/resources/case/dml/select.xml
+++ b/test/it/parser/src/main/resources/case/dml/select.xml
@@ -13276,4 +13276,29 @@
             </subquery-table>
         </from>
     </select>
+
+    <select sql-case-id="select_three_part_column_mysql">
+        <projections start-index="7" stop-index="24">
+            <column-projection name="status" start-index="7" stop-index="24">
+                <owner start-index="11" stop-index="17" name="t_order">
+                    <owner start-index="7" stop-index="9" name="db1" />
+                </owner>
+            </column-projection>
+        </projections>
+        <from>
+            <simple-table name="t_order" start-index="31" stop-index="41">
+                <owner start-index="31" stop-index="33" name="db1" />
+            </simple-table>
+        </from>
+    </select>
+
+    <select sql-case-id="select_string_literal_concat_mysql">
+        <projections start-index="7" stop-index="15">
+            <expression-projection text="abcd" start-index="7" stop-index="15">
+                <expr>
+                    <literal-expression value="abcd" start-index="7" 
stop-index="15" />
+                </expr>
+            </expression-projection>
+        </projections>
+    </select>
 </sql-parser-test-cases>
diff --git 
a/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml 
b/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml
index 71bb82ea856..4b8c8194e2d 100644
--- a/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dml/select-expression.xml
@@ -147,4 +147,6 @@
     <sql-case id="select_with_case_when_from_sys" value="SELECT FileName = 
df.name, current_file_size_MB = df.size*1.0/128, max_size = CASE df.max_size 
WHEN 0 THEN 'Autogrowth is off.' WHEN -1 THEN 'Autogrowth is on.' ELSE 'Log 
file grows to a maximum size of 2 TB.' END, growth_value = CASE WHEN df.growth 
= 0 THEN df.growth WHEN df.growth > 0 AND df.is_percent_growth = 0 THEN 
df.growth*1.0/128.0 WHEN df.growth > 0 AND df.is_percent_growth = 1 THEN 
df.growth END, growth_increment_unit = C [...]
     <sql-case id="select_where_equal_any_subquery_mysql" value="SELECT * FROM 
t_order WHERE amount = ANY (SELECT price FROM t_price)" db-types="MySQL" />
     <sql-case id="select_where_not_equal_all_subquery_mysql" value="SELECT * 
FROM t_order WHERE amount &lt;&gt; ALL (SELECT price FROM t_price)" 
db-types="MySQL" />
+    <sql-case id="select_where_with_safe_equal_parameter_mysql" value="SELECT 
* FROM t_order WHERE status &lt;=&gt; ?" db-types="MySQL" 
case-types="PLACEHOLDER" />
+    <sql-case id="select_where_equal_all_subquery_mysql" value="SELECT * FROM 
t_order WHERE amount = ALL (SELECT price FROM t_price)" db-types="MySQL" />
 </sql-cases>
diff --git 
a/test/it/parser/src/main/resources/sql/supported/dml/select-special-function.xml
 
b/test/it/parser/src/main/resources/sql/supported/dml/select-special-function.xml
index 625a89312a4..e56816e832d 100644
--- 
a/test/it/parser/src/main/resources/sql/supported/dml/select-special-function.xml
+++ 
b/test/it/parser/src/main/resources/sql/supported/dml/select-special-function.xml
@@ -318,4 +318,6 @@
     <sql-case id="select_with_json_object_function" value="SELECT 
JSON_OBJECT('name' VALUE 'John', 'age' VALUE 30) AS json_data FROM DUAL" 
db-types="Oracle" />
     <sql-case id="select_regexp_function" value="SELECT REGEXP('billie 
eillish', '^billie')" db-types="Doris" />
     <sql-case id="select_regexp_function_with_null" value="SELECT REGEXP(NULL, 
'^billie')" db-types="Doris" />
+    <sql-case id="select_current_time_precision_mysql" value="SELECT 
CURRENT_TIME(3)" db-types="MySQL" />
+    <sql-case id="select_odbc_fn_now_mysql" value="SELECT {fn NOW()}" 
db-types="MySQL" />
 </sql-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 a9d9fd8710c..3fc52da30cc 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
@@ -468,4 +468,6 @@
     <sql-case id="select_where_is_false_mysql" value="SELECT * FROM t_order 
WHERE active IS FALSE" db-types="MySQL" />
     <sql-case id="select_where_is_unknown_mysql" value="SELECT * FROM t_order 
WHERE active IS UNKNOWN" db-types="MySQL" />
     <sql-case id="select_null_safe_equal_mysql" value="SELECT * FROM t_order 
WHERE order_id &lt;=&gt; ?" db-types="MySQL" case-types="PLACEHOLDER" />
+    <sql-case id="select_three_part_column_mysql" value="SELECT 
db1.t_order.status FROM db1.t_order" db-types="MySQL" />
+    <sql-case id="select_string_literal_concat_mysql" value="SELECT 'ab' 'cd'" 
db-types="MySQL" />
 </sql-cases>

Reply via email to