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 260ed945bbc Add presto SQL parse test cases (#37618)
260ed945bbc is described below
commit 260ed945bbca410e23e004249ebf240b33744845
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Jan 2 13:01:23 2026 +0800
Add presto SQL parse test cases (#37618)
* Load railroad diagrams via same-domain hash path
* Add presto SQL parse test cases
---
.../parser/src/main/resources/case/ddl/presto.xml | 15 +++
.../parser/src/main/resources/case/dml/presto.xml | 117 +++++++++++++++++++++
.../main/resources/sql/supported/ddl/presto.xml | 3 +
.../main/resources/sql/supported/dml/presto.xml | 5 +
4 files changed, 140 insertions(+)
diff --git a/test/it/parser/src/main/resources/case/ddl/presto.xml
b/test/it/parser/src/main/resources/case/ddl/presto.xml
index d9c9f989902..38f9fea7518 100644
--- a/test/it/parser/src/main/resources/case/ddl/presto.xml
+++ b/test/it/parser/src/main/resources/case/ddl/presto.xml
@@ -27,4 +27,19 @@
<column name="amount" />
</column-definition>
</create-table>
+
+ <create-table sql-case-id="presto_create_table_varchar">
+ <table name="t_alpha" start-index="13" stop-index="19" />
+ <column-definition type="VARCHAR" start-index="21" stop-index="36">
+ <column name="name" />
+ </column-definition>
+ </create-table>
+
+ <drop-table sql-case-id="presto_drop_table_if_exists">
+ <table name="t_price" start-index="21" stop-index="27" />
+ </drop-table>
+
+ <drop-view sql-case-id="presto_drop_view_if_exists">
+ <view name="v_price" start-index="20" stop-index="26" />
+ </drop-view>
</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/case/dml/presto.xml
b/test/it/parser/src/main/resources/case/dml/presto.xml
index ebcb60c08eb..c72fd6a598a 100644
--- a/test/it/parser/src/main/resources/case/dml/presto.xml
+++ b/test/it/parser/src/main/resources/case/dml/presto.xml
@@ -371,4 +371,121 @@
</expr>
</where>
</select>
+
+ <select sql-case-id="presto_select_xor">
+ <from>
+ <simple-table name="t_order" start-index="14" stop-index="20" />
+ </from>
+ <projections start-index="7" stop-index="7">
+ <shorthand-projection start-index="7" stop-index="7" />
+ </projections>
+ <where start-index="22" stop-index="37">
+ <expr>
+ <binary-operation-expression start-index="28" stop-index="37">
+ <left>
+ <column name="flag" start-index="28" stop-index="31" />
+ </left>
+ <operator>XOR</operator>
+ <right>
+ <literal-expression value="1" start-index="37"
stop-index="37" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </where>
+ </select>
+
+ <select sql-case-id="presto_select_safe_equal">
+ <from>
+ <simple-table name="t_order" start-index="14" stop-index="20" />
+ </from>
+ <projections start-index="7" stop-index="7">
+ <shorthand-projection start-index="7" stop-index="7" />
+ </projections>
+ <where start-index="22" stop-index="40">
+ <expr>
+ <binary-operation-expression start-index="28" stop-index="40">
+ <left>
+ <column name="flag" start-index="28" stop-index="31" />
+ </left>
+ <operator><=></operator>
+ <right>
+ <literal-expression value="true" start-index="37"
stop-index="40" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </where>
+ </select>
+
+ <select sql-case-id="presto_select_member_of">
+ <from>
+ <simple-table name="t_order" start-index="14" stop-index="20" />
+ </from>
+ <projections start-index="7" stop-index="7">
+ <shorthand-projection start-index="7" stop-index="7" />
+ </projections>
+ <where start-index="22" stop-index="54">
+ <expr>
+ <binary-operation-expression start-index="28" stop-index="54">
+ <left>
+ <column name="order_id" start-index="28"
stop-index="35" />
+ </left>
+ <operator>MEMBER OF</operator>
+ <right>
+ <expression-projection text=""[1,2]""
start-index="47" stop-index="53" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </where>
+ </select>
+
+ <select sql-case-id="presto_select_in_params">
+ <from>
+ <simple-table name="t_order" start-index="14" stop-index="20" />
+ </from>
+ <projections start-index="7" stop-index="7">
+ <shorthand-projection start-index="7" stop-index="7" />
+ </projections>
+ <where start-index="22" stop-index="45">
+ <expr>
+ <in-expression start-index="28" stop-index="45">
+ <not>false</not>
+ <left>
+ <column name="order_id" start-index="28"
stop-index="35" />
+ </left>
+ <right>
+ <list-expression start-index="40" stop-index="45">
+ <items>
+ <literal-expression value="1" start-index="41"
stop-index="41" />
+ </items>
+ <items>
+ <literal-expression value="2" start-index="44"
stop-index="44" />
+ </items>
+ </list-expression>
+ </right>
+ </in-expression>
+ </expr>
+ </where>
+ </select>
+
+ <select sql-case-id="presto_select_sounds_like">
+ <from>
+ <simple-table name="t_order" start-index="14" stop-index="20" />
+ </from>
+ <projections start-index="7" stop-index="7">
+ <shorthand-projection start-index="7" stop-index="7" />
+ </projections>
+ <where start-index="22" stop-index="50">
+ <expr>
+ <binary-operation-expression start-index="28" stop-index="50">
+ <left>
+ <column name="status" start-index="28" stop-index="33"
/>
+ </left>
+ <operator>SOUNDS LIKE</operator>
+ <right>
+ <literal-expression value="ok" start-index="47"
stop-index="50" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </where>
+ </select>
</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/ddl/presto.xml
b/test/it/parser/src/main/resources/sql/supported/ddl/presto.xml
index 607ab07d1de..748c68c4e40 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/presto.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/presto.xml
@@ -18,4 +18,7 @@
<sql-cases>
<sql-case id="presto_create_table_decimal" value="CREATE TABLE
catalog.schem1.t_price (amount DECIMAL(10,2))" db-types="Presto" />
+ <sql-case id="presto_create_table_varchar" value="CREATE TABLE
t_alpha(name VARCHAR(20))" db-types="Presto" />
+ <sql-case id="presto_drop_table_if_exists" value="DROP TABLE IF EXISTS
t_price" db-types="Presto" />
+ <sql-case id="presto_drop_view_if_exists" value="DROP VIEW IF EXISTS
v_price" db-types="Presto" />
</sql-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dml/presto.xml
b/test/it/parser/src/main/resources/sql/supported/dml/presto.xml
index b878305a582..ceebc985233 100644
--- a/test/it/parser/src/main/resources/sql/supported/dml/presto.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dml/presto.xml
@@ -27,4 +27,9 @@
<sql-case id="presto_select_case_binary_variable" value="SELECT CASE
catalog.schem1.order_id WHEN 1 THEN 'one' ELSE 'other' END, BINARY status,
@user_value FROM t_order" db-types="Presto" />
<sql-case id="presto_select_concat_match_interval" value="SELECT status ||
'X', MATCH(status) AGAINST ('kw'), INTERVAL '1' DAY, catalog.fn(order_id) FROM
t_order" db-types="Presto" />
<sql-case id="presto_select_is_true" value="SELECT * FROM t_order WHERE
flag IS TRUE" db-types="Presto" />
+ <sql-case id="presto_select_xor" value="SELECT * FROM t_order WHERE flag
XOR 1" db-types="Presto" />
+ <sql-case id="presto_select_safe_equal" value="SELECT * FROM t_order WHERE
flag <=> TRUE" db-types="Presto" />
+ <sql-case id="presto_select_member_of" value="SELECT * FROM t_order WHERE
order_id MEMBER OF("[1,2]")" db-types="Presto" />
+ <sql-case id="presto_select_in_params" value="SELECT * FROM t_order WHERE
order_id IN (1, 2)" db-types="Presto" />
+ <sql-case id="presto_select_sounds_like" value="SELECT * FROM t_order
WHERE status SOUNDS LIKE 'ok'" db-types="Presto" />
</sql-cases>