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 3ae46a39152 Add SQL parser test cases for Firebird (#37721)
3ae46a39152 is described below

commit 3ae46a3915230fa9c38e42732523fdba17ae3d63
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Jan 12 23:14:09 2026 +0800

    Add SQL parser test cases for Firebird (#37721)
---
 .../parser/src/main/resources/case/ddl/comment.xml |   7 +
 .../src/main/resources/case/ddl/create-table.xml   |  26 ++
 .../src/main/resources/case/ddl/drop-table.xml     |   4 +
 .../parser/src/main/resources/case/dml/insert.xml  |  14 +
 .../parser/src/main/resources/case/dml/select.xml  | 284 +++++++++++++++++++++
 .../main/resources/sql/supported/ddl/comment.xml   |   2 +
 .../resources/sql/supported/ddl/create-table.xml   |   2 +
 .../resources/sql/supported/ddl/drop-table.xml     |   1 +
 .../main/resources/sql/supported/dml/insert.xml    |   1 +
 .../main/resources/sql/supported/dml/select.xml    |  13 +
 10 files changed, 354 insertions(+)

diff --git a/test/it/parser/src/main/resources/case/ddl/comment.xml 
b/test/it/parser/src/main/resources/case/ddl/comment.xml
index 907ed98cfd7..93620164c79 100644
--- a/test/it/parser/src/main/resources/case/ddl/comment.xml
+++ b/test/it/parser/src/main/resources/case/ddl/comment.xml
@@ -57,4 +57,11 @@
     <comment sql-case-id="comment_on_procedure" />
     <comment sql-case-id="comment_on_tablespace" />
     <comment sql-case-id="comment_on_text_search_template" />
+    <comment sql-case-id="comment_table_firebird">
+        <table name="t_order" start-index="17" stop-index="23" />
+    </comment>
+    <comment sql-case-id="comment_column_firebird">
+        <table name="t_order" start-index="18" stop-index="24" />
+        <column name="status" start-index="26" stop-index="31" />
+    </comment>
 </sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/case/ddl/create-table.xml 
b/test/it/parser/src/main/resources/case/ddl/create-table.xml
index 26385afb8d0..3f8b11d069b 100644
--- a/test/it/parser/src/main/resources/case/ddl/create-table.xml
+++ b/test/it/parser/src/main/resources/case/ddl/create-table.xml
@@ -3754,4 +3754,30 @@
             <column name="payload" />
         </column-definition>
     </create-table>
+
+    <create-table sql-case-id="create_table_firebird_len">
+        <table name="t_firebird_len" start-index="13" stop-index="26" />
+        <column-definition type="INT" primary-key="true" start-index="29" 
stop-index="46">
+            <column name="id" />
+        </column-definition>
+        <column-definition type="DECIMAL" start-index="49" stop-index="68">
+            <column name="amount" />
+        </column-definition>
+        <column-definition type="CHAR" start-index="71" stop-index="82">
+            <column name="code" />
+        </column-definition>
+    </create-table>
+
+    <create-table sql-case-id="create_table_firebird_constraint">
+        <table name="t_firebird_constraint" start-index="13" stop-index="33" />
+        <column-definition type="INT" start-index="36" stop-index="41">
+            <column name="id" />
+        </column-definition>
+        <constraint-definition constraint-name="pk_t" start-index="44" 
stop-index="75">
+            <primary-key-column name="id" start-index="73" stop-index="74" />
+        </constraint-definition>
+        <constraint-definition constraint-name="fk_t" start-index="78" 
stop-index="139">
+            <referenced-table name="t_firebird_len" start-index="122" 
stop-index="135" />
+        </constraint-definition>
+    </create-table>
 </sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/case/ddl/drop-table.xml 
b/test/it/parser/src/main/resources/case/ddl/drop-table.xml
index 00d123301c9..153832b8d52 100644
--- a/test/it/parser/src/main/resources/case/ddl/drop-table.xml
+++ b/test/it/parser/src/main/resources/case/ddl/drop-table.xml
@@ -119,4 +119,8 @@
             <owner name="test_db" start-index="21" stop-index="27" />
         </table>
     </drop-table>
+
+    <drop-table sql-case-id="drop_table_firebird">
+        <table name="t_firebird_drop" start-index="11" stop-index="25" />
+    </drop-table>
 </sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/case/dml/insert.xml 
b/test/it/parser/src/main/resources/case/dml/insert.xml
index 8be1af68441..34aa02ddea1 100644
--- a/test/it/parser/src/main/resources/case/dml/insert.xml
+++ b/test/it/parser/src/main/resources/case/dml/insert.xml
@@ -4461,6 +4461,20 @@
         </returning>
     </insert>
 
+    <insert sql-case-id="insert_default_firebird">
+        <table name="t_order" start-index="12" stop-index="18" />
+        <columns start-index="20" stop-index="23">
+            <column name="id" start-index="21" stop-index="22" />
+        </columns>
+        <values>
+            <value>
+                <assignment-value>
+                    <common-expression text="DEFAULT" start-index="33" 
stop-index="40" />
+                </assignment-value>
+            </value>
+        </values>
+    </insert>
+
     <insert sql-case-id="insert_with_geom_collection_function">
         <table name="t1" start-index="12" stop-index="13" />
         <columns start-index="14" stop-index="14" />
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 f4b020c8f44..c1d7f88307b 100644
--- a/test/it/parser/src/main/resources/case/dml/select.xml
+++ b/test/it/parser/src/main/resources/case/dml/select.xml
@@ -12258,4 +12258,288 @@
             <simple-table name="t_order" start-index="22" stop-index="28" />
         </from>
     </select>
+
+    <select sql-case-id="select_schema_table_firebird">
+        <projections start-index="7" stop-index="7">
+            <shorthand-projection start-index="7" stop-index="7" />
+        </projections>
+        <from>
+            <simple-table name="t_order" start-index="14" stop-index="28">
+                <owner name="schema1" start-index="14" stop-index="20" />
+            </simple-table>
+        </from>
+    </select>
+
+    <select sql-case-id="select_where_and_like_firebird">
+        <projections start-index="7" stop-index="7">
+            <shorthand-projection start-index="7" stop-index="7" />
+        </projections>
+        <from>
+            <simple-table name="t_order" start-index="14" stop-index="20" />
+        </from>
+        <where start-index="22" stop-index="59">
+            <expr>
+                <binary-operation-expression start-index="28" stop-index="59">
+                    <left>
+                        <binary-operation-expression start-index="28" 
stop-index="38">
+                            <left>
+                                <column name="user_id" start-index="28" 
stop-index="34" />
+                            </left>
+                            <operator>=</operator>
+                            <right>
+                                <literal-expression value="1" start-index="38" 
stop-index="38" />
+                            </right>
+                        </binary-operation-expression>
+                    </left>
+                    <operator>AND</operator>
+                    <right>
+                        <binary-operation-expression start-index="44" 
stop-index="59">
+                            <left>
+                                <column name="status" start-index="44" 
stop-index="49" />
+                            </left>
+                            <operator>LIKE</operator>
+                            <right>
+                                <list-expression start-index="56" 
stop-index="59">
+                                    <items>
+                                        <literal-expression value="A%" 
start-index="56" stop-index="59" />
+                                    </items>
+                                </list-expression>
+                            </right>
+                        </binary-operation-expression>
+                    </right>
+                </binary-operation-expression>
+            </expr>
+        </where>
+    </select>
+
+    <select sql-case-id="select_safe_eq_firebird">
+        <projections start-index="7" stop-index="13">
+            <expression-projection text="1 &lt;=&gt; 1" start-index="7" 
stop-index="13">
+                <expr>
+                    <binary-operation-expression start-index="7" 
stop-index="13">
+                        <left>
+                            <literal-expression value="1" start-index="7" 
stop-index="7" />
+                        </left>
+                        <operator>&lt;=&gt;</operator>
+                        <right>
+                            <literal-expression value="1" start-index="13" 
stop-index="13" />
+                        </right>
+                    </binary-operation-expression>
+                </expr>
+            </expression-projection>
+        </projections>
+    </select>
+
+    <select sql-case-id="select_in_list_firebird">
+        <projections start-index="7" stop-index="7">
+            <shorthand-projection start-index="7" stop-index="7" />
+        </projections>
+        <from>
+            <simple-table name="t_order" start-index="14" stop-index="20" />
+        </from>
+        <where start-index="22" stop-index="38">
+            <expr>
+                <in-expression start-index="28" stop-index="38">
+                    <not>false</not>
+                    <left>
+                        <column name="id" start-index="28" stop-index="29" />
+                    </left>
+                    <right>
+                        <list-expression start-index="34" stop-index="38">
+                            <items>
+                                <literal-expression value="1" start-index="35" 
stop-index="35" />
+                            </items>
+                            <items>
+                                <literal-expression value="2" start-index="37" 
stop-index="37" />
+                            </items>
+                        </list-expression>
+                    </right>
+                </in-expression>
+            </expr>
+        </where>
+    </select>
+
+    <select sql-case-id="select_not_in_list_firebird">
+        <projections start-index="7" stop-index="7">
+            <shorthand-projection start-index="7" stop-index="7" />
+        </projections>
+        <from>
+            <simple-table name="t_order" start-index="14" stop-index="20" />
+        </from>
+        <where start-index="22" stop-index="42">
+            <expr>
+                <in-expression start-index="28" stop-index="42">
+                    <not>true</not>
+                    <left>
+                        <column name="id" start-index="28" stop-index="29" />
+                    </left>
+                    <right>
+                        <list-expression start-index="38" stop-index="42">
+                            <items>
+                                <literal-expression value="1" start-index="39" 
stop-index="39" />
+                            </items>
+                            <items>
+                                <literal-expression value="2" start-index="41" 
stop-index="41" />
+                            </items>
+                        </list-expression>
+                    </right>
+                </in-expression>
+            </expr>
+        </where>
+    </select>
+
+    <select sql-case-id="select_not_between_firebird">
+        <projections start-index="7" stop-index="7">
+            <shorthand-projection start-index="7" stop-index="7" />
+        </projections>
+        <from>
+            <simple-table name="t_order" start-index="14" stop-index="20" />
+        </from>
+        <where start-index="22" stop-index="49">
+            <expr>
+                <between-expression start-index="28" stop-index="49">
+                    <not>true</not>
+                    <left>
+                        <column name="id" start-index="28" stop-index="29" />
+                    </left>
+                    <between-expr>
+                        <literal-expression value="1" start-index="43" 
stop-index="43" />
+                    </between-expr>
+                    <and-expr>
+                        <literal-expression value="5" start-index="49" 
stop-index="49" />
+                    </and-expr>
+                </between-expression>
+            </expr>
+        </where>
+    </select>
+
+    <select sql-case-id="select_case_expr_firebird">
+        <projections start-index="7" stop-index="30">
+            <expression-projection text="CASEWHEN1=1THEN1END" start-index="7" 
stop-index="30">
+                <expr>
+                    <common-expression text="CASEWHEN1=1THEN1END" 
start-index="7" stop-index="30" />
+                </expr>
+            </expression-projection>
+        </projections>
+        <from>
+            <simple-table name="t_order" start-index="37" stop-index="43" />
+        </from>
+    </select>
+
+    <select sql-case-id="select_cast_literal_firebird">
+        <projections start-index="7" stop-index="28">
+            <expression-projection text="CAST(1 AS VARCHAR(10))" 
start-index="7" stop-index="28">
+                <expr>
+                    <function function-name="CAST" text="CAST(1 AS 
VARCHAR(10))" start-index="7" stop-index="28">
+                        <parameter>
+                            <literal-expression value="1" start-index="12" 
stop-index="12" />
+                        </parameter>
+                        <parameter>
+                            <data-type value="VARCHAR" start-index="17" 
stop-index="27">
+                                <data-type-length precision="10" 
start-index="25" stop-index="27" />
+                            </data-type>
+                        </parameter>
+                    </function>
+                </expr>
+            </expression-projection>
+        </projections>
+        <from>
+            <simple-table name="t_order" start-index="35" stop-index="41" />
+        </from>
+    </select>
+
+    <select sql-case-id="select_variable_identifier_firebird">
+        <projections start-index="7" stop-index="15">
+            <expression-projection text="var" start-index="7" stop-index="15">
+                <expr>
+                    <variable-segment variable="var" start-index="7" 
stop-index="15" />
+                </expr>
+            </expression-projection>
+        </projections>
+        <from>
+            <simple-table name="t_order" start-index="22" stop-index="28" />
+        </from>
+    </select>
+
+    <select sql-case-id="select_comma_join_firebird">
+        <projections start-index="7" stop-index="7">
+            <shorthand-projection start-index="7" stop-index="7" />
+        </projections>
+        <from>
+            <join-table join-type="COMMA">
+                <left>
+                    <simple-table name="t_order" alias="a" start-index="14" 
stop-index="22" />
+                </left>
+                <right>
+                    <simple-table name="t_order_item" alias="b" 
start-index="25" stop-index="38" />
+                </right>
+            </join-table>
+        </from>
+    </select>
+
+    <select sql-case-id="select_union_firebird">
+        <projections start-index="7" stop-index="7">
+            <expression-projection text="1" start-index="7" stop-index="7">
+                <expr>
+                    <literal-expression value="1" start-index="7" 
stop-index="7" />
+                </expr>
+            </expression-projection>
+        </projections>
+    </select>
+
+    <select sql-case-id="select_subquery_table_firebird">
+        <projections start-index="7" stop-index="7">
+            <shorthand-projection start-index="7" stop-index="7" />
+        </projections>
+        <from>
+            <subquery-table alias="sub" start-index="14" stop-index="27">
+                <subquery start-index="14" stop-index="23">
+                    <select>
+                        <projections start-index="22" stop-index="22">
+                            <expression-projection text="1" start-index="22" 
stop-index="22">
+                                <expr>
+                                    <literal-expression value="1" 
start-index="22" stop-index="22" />
+                                </expr>
+                            </expression-projection>
+                        </projections>
+                    </select>
+                </subquery>
+            </subquery-table>
+        </from>
+    </select>
+
+    <select sql-case-id="select_subquery_with_with_firebird">
+        <projections start-index="7" stop-index="7">
+            <shorthand-projection start-index="7" stop-index="7" />
+        </projections>
+        <from>
+            <subquery-table alias="sub" start-index="14" stop-index="55">
+                <subquery start-index="14" stop-index="51">
+                    <select>
+                        <with start-index="15" stop-index="34">
+                            <common-table-expression name="t" start-index="20" 
stop-index="34">
+                                <subquery start-index="20" stop-index="34">
+                                    <select>
+                                        <projections start-index="33" 
stop-index="33">
+                                            <expression-projection text="1" 
start-index="33" stop-index="33">
+                                                <expr>
+                                                    <literal-expression 
value="1" start-index="33" stop-index="33" />
+                                                </expr>
+                                            </expression-projection>
+                                        </projections>
+                                    </select>
+                                </subquery>
+                            </common-table-expression>
+                        </with>
+                        <projections start-index="43" stop-index="43">
+                            <shorthand-projection start-index="43" 
stop-index="43" />
+                        </projections>
+                        <from>
+                            <simple-table name="t" start-index="50" 
stop-index="50" />
+                        </from>
+                    </select>
+                </subquery>
+            </subquery-table>
+        </from>
+    </select>
 </sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/ddl/comment.xml 
b/test/it/parser/src/main/resources/sql/supported/ddl/comment.xml
index 48dcf248e39..bbed4ba3603 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/comment.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/comment.xml
@@ -42,4 +42,6 @@
     <sql-case id="comment_on_procedure" value="COMMENT ON PROCEDURE my_proc 
(integer, integer) IS 'Runs a report';" db-types="PostgreSQL" />
     <sql-case id="comment_on_tablespace" value="COMMENT ON TABLESPACE 
my_tablespace IS 'Tablespace for indexes';" db-types="PostgreSQL" />
     <sql-case id="comment_on_text_search_template" value="COMMENT ON TEXT 
SEARCH TEMPLATE snowball IS 'Snowball stemmer';" db-types="PostgreSQL" />
+    <sql-case id="comment_table_firebird" value="COMMENT ON TABLE t_order IS 
'order table'" db-types="Firebird" />
+    <sql-case id="comment_column_firebird" value="COMMENT ON COLUMN 
t_order.status IS 'status column'" db-types="Firebird" />
 </sql-cases>
diff --git 
a/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml 
b/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml
index c6ba5a5adbd..c7d985f8606 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml
@@ -519,4 +519,6 @@
     <sql-case id="create_table_with_blob_subtype_numeric" value="CREATE TABLE 
t_blob_subtype_numeric (payload BLOB SUB_TYPE 1)" db-types="Firebird" />
     <sql-case id="create_table_with_blob_subtype_text" value="CREATE TABLE 
t_blob_subtype_text (payload BLOB SUB_TYPE TEXT CHARACTER SET UTF8)" 
db-types="Firebird" />
     <sql-case id="create_table_with_blob_segment_size" value="CREATE TABLE 
t_blob_segment (payload BLOB SUB_TYPE 0 SEGMENT SIZE 80)" db-types="Firebird" />
+    <sql-case id="create_table_firebird_len" value="CREATE TABLE 
t_firebird_len (id INT PRIMARY KEY, amount DECIMAL(10,2), code CHAR(5))" 
db-types="Firebird" />
+    <sql-case id="create_table_firebird_constraint" value="CREATE TABLE 
t_firebird_constraint (id INT, CONSTRAINT pk_t PRIMARY KEY (id), CONSTRAINT 
fk_t FOREIGN KEY (id) REFERENCES t_firebird_len(id))" db-types="Firebird" />
 </sql-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/ddl/drop-table.xml 
b/test/it/parser/src/main/resources/sql/supported/ddl/drop-table.xml
index 3967a3f6269..50800d0f5c3 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/drop-table.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/drop-table.xml
@@ -41,4 +41,5 @@
     <sql-case id="drop_table_if_exists_hive_with_db" value="DROP TABLE IF 
EXISTS test_db.t_log" db-types="Hive" />
     <sql-case id="drop_table_purge_hive_with_db" value="DROP TABLE 
test_db.t_log PURGE" db-types="Hive" />
     <sql-case id="drop_table_if_exists_purge_hive_with_db" value="DROP TABLE 
IF EXISTS test_db.t_log PURGE" db-types="Hive" />
+    <sql-case id="drop_table_firebird" value="DROP TABLE t_firebird_drop" 
db-types="Firebird"/>
 </sql-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dml/insert.xml 
b/test/it/parser/src/main/resources/sql/supported/dml/insert.xml
index c0bfa1db011..8e0e10c8333 100644
--- a/test/it/parser/src/main/resources/sql/supported/dml/insert.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dml/insert.xml
@@ -159,6 +159,7 @@
     <sql-case id="insert_with_aes_encrypt" value="INSERT INTO 
t_order_item(item_id,encrypt) VALUES (1,AES_ENCRYPT('text','key_str'))" 
db-types="MySQL" />
     <sql-case id="insert_on_duplicate_key_update_with_values" value="INSERT 
INTO table (a,b,c) VALUES (1,2,3),(4,5,6) ON DUPLICATE KEY UPDATE 
c=VALUES(a)+VALUES(b);" db-types="MySQL" />
     <sql-case id="insert_returning_expressions" value="INSERT INTO t2 (id) 
VALUES (2),(3) RETURNING id,t&amp;t" db-types="MySQL,Firebird" />
+    <sql-case id="insert_default_firebird" value="INSERT INTO t_order (id) 
VALUES (DEFAULT)" db-types="Firebird"/>
     <sql-case id="insert_with_geom_collection_function" value="INSERT INTO t1 
VALUES (GEOMCOLLECTION(POINT(0, 0)))" db-types="MySQL" />
     <sql-case id="insert_select_with_brackets" value="insert into t_order 
(order_id) (select order_id from t_order_item)" db-types="MySQL" />
     <sql-case id="insert_into_four_level_naming" value="INSERT INTO 
MyLinkServer.AdventureWorks2022.HumanResources.Department (Name, GroupName) 
VALUES (N'Public Relations', N'Executive General and Administration');" 
db-types="SQLServer"/>
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 39cf071fc57..9a1ecdd6497 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
@@ -410,4 +410,17 @@
     <sql-case id="select_gen_id_with_parameters_firebird" value="SELECT 
GEN_ID(?, ?) FROM t_order" db-types="Firebird" case-types="Placeholder"/>
     <sql-case id="select_variable_default_firebird" value="SELECT DEFAULT FROM 
t_order" db-types="Firebird"/>
     <sql-case id="select_parenthesized_column_firebird" value="SELECT 
(user_id) FROM t_order" db-types="Firebird"/>
+    <sql-case id="select_schema_table_firebird" value="SELECT * FROM 
schema1.t_order" db-types="Firebird"/>
+    <sql-case id="select_where_and_like_firebird" value="SELECT * FROM t_order 
WHERE user_id = 1 AND status LIKE 'A%'" db-types="Firebird"/>
+    <sql-case id="select_safe_eq_firebird" value="SELECT 1 &lt;=&gt; 1" 
db-types="Firebird"/>
+    <sql-case id="select_in_list_firebird" value="SELECT * FROM t_order WHERE 
id IN (1,2)" db-types="Firebird"/>
+    <sql-case id="select_not_in_list_firebird" value="SELECT * FROM t_order 
WHERE id NOT IN (1,2)" db-types="Firebird"/>
+    <sql-case id="select_not_between_firebird" value="SELECT * FROM t_order 
WHERE id NOT BETWEEN 1 AND 5" db-types="Firebird"/>
+    <sql-case id="select_case_expr_firebird" value="SELECT CASE WHEN 1=1 THEN 
1 END FROM t_order" db-types="Firebird"/>
+    <sql-case id="select_cast_literal_firebird" value="SELECT CAST(1 AS 
VARCHAR(10)) FROM t_order" db-types="Firebird"/>
+    <sql-case id="select_variable_identifier_firebird" value="SELECT LOCAL.var 
FROM t_order" db-types="Firebird"/>
+    <sql-case id="select_comma_join_firebird" value="SELECT * FROM t_order a, 
t_order_item b" db-types="Firebird"/>
+    <sql-case id="select_union_firebird" value="SELECT 1 UNION SELECT 2" 
db-types="Firebird"/>
+    <sql-case id="select_subquery_table_firebird" value="SELECT * FROM (SELECT 
1) sub" db-types="Firebird"/>
+    <sql-case id="select_subquery_with_with_firebird" value="SELECT * FROM 
(WITH t AS (SELECT 1) SELECT * FROM t) sub" db-types="Firebird"/>
 </sql-cases>

Reply via email to