You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ch...@apache.org on 2026/03/19 02:49:06 UTC

(shardingsphere) branch master updated: Add SQL Bind IT case for MICROSECOND keyword in TIMESTAMPADD function (#38500)

This is an automated email from the ASF dual-hosted git repository.

chengzhang 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 38cc4c31426 Add SQL Bind IT case for MICROSECOND keyword in TIMESTAMPADD function (#38500)
38cc4c31426 is described below

commit 38cc4c31426bfb0f45213456869d5d3e7a6ff10b
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Thu Mar 19 10:49:00 2026 +0800

    Add SQL Bind IT case for MICROSECOND keyword in TIMESTAMPADD function (#38500)
---
 .../binder/src/test/resources/cases/dml/update.xml | 71 ++++++++++++++++++++++
 .../binder/src/test/resources/sqls/dml/update.xml  |  1 +
 2 files changed, 72 insertions(+)

diff --git a/test/it/binder/src/test/resources/cases/dml/update.xml b/test/it/binder/src/test/resources/cases/dml/update.xml
index c8e51050e68..08e3f071d8c 100644
--- a/test/it/binder/src/test/resources/cases/dml/update.xml
+++ b/test/it/binder/src/test/resources/cases/dml/update.xml
@@ -78,4 +78,75 @@
             <row-count value="1" start-index="73" stop-index="73" />
         </limit>
     </update>
+    <update sql-case-id="update_with_timestampadd_microsecond">
+        <table start-index="7" stop-index="13">
+            <simple-table name="t_order" start-index="7" stop-index="13">
+                <table-bound>
+                    <original-database name="foo_db_1" />
+                    <original-schema name="foo_db_1" />
+                </table-bound>
+            </simple-table>
+        </table>
+        <set start-index="15" stop-index="77">
+            <assignment start-index="19" stop-index="77">
+                <column name="creation_date" start-index="19" stop-index="31">
+                    <column-bound>
+                        <original-database name="foo_db_1" />
+                        <original-schema name="foo_db_1" />
+                        <original-table name="t_order" />
+                        <original-column name="creation_date" start-delimiter="`" end-delimiter="`" />
+                        <table-source-type name="PHYSICAL_TABLE"/>
+                    </column-bound>
+                </column>
+                <assignment-value>
+                    <function function-name="TIMESTAMPADD" text="TIMESTAMPADD(MICROSECOND, ?, creation_date)" start-index="35" stop-index="77">
+                        <parameter>
+                            <interval-unit-expression start-index="48" stop-index="58">
+                                <interval-unit>MICROSECOND</interval-unit>
+                            </interval-unit-expression>
+                        </parameter>
+                        <parameter>
+                            <parameter-marker-expression parameter-index="0" start-index="61" stop-index="61" />
+                        </parameter>
+                        <parameter>
+                            <column name="creation_date" start-index="64" stop-index="76">
+                                <column-bound>
+                                    <original-database name="foo_db_1" />
+                                    <original-schema name="foo_db_1" />
+                                    <original-table name="t_order" />
+                                    <original-column name="creation_date" start-delimiter="`" end-delimiter="`" />
+                                    <table-source-type name="PHYSICAL_TABLE"/>
+                                </column-bound>
+                            </column>
+                        </parameter>
+                    </function>
+                </assignment-value>
+            </assignment>
+        </set>
+        <where start-index="79" stop-index="96">
+            <expr>
+                <binary-operation-expression start-index="85" stop-index="96">
+                    <left>
+                        <column name="order_id" start-index="85" stop-index="92">
+                            <column-bound>
+                                <original-database name="foo_db_1" />
+                                <original-schema name="foo_db_1" />
+                                <original-table name="t_order" />
+                                <original-column name="order_id" start-delimiter="`" end-delimiter="`" />
+                                <table-source-type name="PHYSICAL_TABLE"/>
+                            </column-bound>
+                        </column>
+                    </left>
+                    <operator>=</operator>
+                    <right>
+                        <parameter-marker-expression parameter-index="1" start-index="96" stop-index="96" />
+                    </right>
+                </binary-operation-expression>
+            </expr>
+        </where>
+        <parameters>
+            <parameter-marker-expression parameter-index="0" start-index="61" stop-index="61" />
+            <parameter-marker-expression parameter-index="1" start-index="96" stop-index="96" />
+        </parameters>
+    </update>
 </sql-parser-test-cases>
diff --git a/test/it/binder/src/test/resources/sqls/dml/update.xml b/test/it/binder/src/test/resources/sqls/dml/update.xml
index 3bbd5d91711..4aea98d9649 100644
--- a/test/it/binder/src/test/resources/sqls/dml/update.xml
+++ b/test/it/binder/src/test/resources/sqls/dml/update.xml
@@ -18,4 +18,5 @@
 
 <sql-cases>
     <sql-case id="update_order_by" value="UPDATE t_order SET user_id = 1 WHERE order_id = 1 ORDER BY user_id LIMIT 1" db-types="MySQL"/>
+    <sql-case id="update_with_timestampadd_microsecond" value="UPDATE t_order SET creation_date = TIMESTAMPADD(MICROSECOND, ?, creation_date) WHERE order_id = ?" db-types="MySQL" case-types="PLACEHOLDER"/>
 </sql-cases>