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 9696b5b56c2 Add SQL parser test cases on ClickHouse (#37605)
9696b5b56c2 is described below
commit 9696b5b56c255dc78ae3b5a1e924f6ebff2f2625
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Jan 1 16:51:20 2026 +0800
Add SQL parser test cases on ClickHouse (#37605)
---
.../src/main/resources/case/dml/clickhouse.xml | 98 ++++++++++++++++++++++
.../resources/sql/supported/dml/clickhouse.xml | 3 +
2 files changed, 101 insertions(+)
diff --git a/test/it/parser/src/main/resources/case/dml/clickhouse.xml
b/test/it/parser/src/main/resources/case/dml/clickhouse.xml
index 85d40f2170c..b7db34f579e 100644
--- a/test/it/parser/src/main/resources/case/dml/clickhouse.xml
+++ b/test/it/parser/src/main/resources/case/dml/clickhouse.xml
@@ -717,6 +717,104 @@
</from>
</select>
+ <select sql-case-id="clickhouse_select_or_boolean">
+ <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="57">
+ <expr>
+ <binary-operation-expression start-index="28" stop-index="57">
+ <left>
+ <binary-operation-expression start-index="28"
stop-index="41">
+ <left>
+ <column name="status" start-index="28"
stop-index="33" />
+ </left>
+ <operator>IS</operator>
+ <right>
+ <literal-expression value="TRUE"
start-index="38" stop-index="41" />
+ </right>
+ </binary-operation-expression>
+ </left>
+ <operator>OR</operator>
+ <right>
+ <binary-operation-expression start-index="46"
stop-index="57">
+ <left>
+ <column name="amount" start-index="46"
stop-index="51" />
+ </left>
+ <operator>></operator>
+ <right>
+ <literal-expression value="100"
start-index="55" stop-index="57" />
+ </right>
+ </binary-operation-expression>
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </where>
+ </select>
+
+ <select sql-case-id="clickhouse_select_is_false">
+ <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="46">
+ <expr>
+ <binary-operation-expression start-index="28" stop-index="46">
+ <left>
+ <column name="is_deleted" start-index="28"
stop-index="37" />
+ </left>
+ <operator>IS</operator>
+ <right>
+ <literal-expression value="FALSE" start-index="42"
stop-index="46" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </where>
+ </select>
+
+ <select sql-case-id="clickhouse_select_parenthesized_right_cross_join">
+ <projections start-index="7" stop-index="7">
+ <shorthand-projection start-index="7" stop-index="7" />
+ </projections>
+ <from>
+ <join-table join-type="CROSS" start-index="15" stop-index="97">
+ <left>
+ <join-table join-type="RIGHT" start-index="15"
stop-index="76">
+ <left>
+ <simple-table name="t_order" alias="o"
start-index="15" stop-index="23" />
+ </left>
+ <right>
+ <simple-table name="t_order_item" alias="i"
start-index="36" stop-index="49" />
+ </right>
+ <on-condition>
+ <binary-operation-expression start-index="54"
stop-index="76">
+ <left>
+ <column name="order_id" start-index="54"
stop-index="63">
+ <owner name="o" start-index="54"
stop-index="54" />
+ </column>
+ </left>
+ <operator>=</operator>
+ <right>
+ <column name="order_id" start-index="67"
stop-index="76">
+ <owner name="i" start-index="67"
stop-index="67" />
+ </column>
+ </right>
+ </binary-operation-expression>
+ </on-condition>
+ </join-table>
+ </left>
+ <right>
+ <simple-table name="t_user" alias="u" start-index="90"
stop-index="97" />
+ </right>
+ </join-table>
+ </from>
+ </select>
+
<update sql-case-id="clickhouse_update_set_default">
<table start-index="7" stop-index="13">
<simple-table name="t_order" start-index="7" stop-index="13" />
diff --git a/test/it/parser/src/main/resources/sql/supported/dml/clickhouse.xml
b/test/it/parser/src/main/resources/sql/supported/dml/clickhouse.xml
index 09d3e8822d3..5bceb451be4 100644
--- a/test/it/parser/src/main/resources/sql/supported/dml/clickhouse.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dml/clickhouse.xml
@@ -36,6 +36,9 @@
<sql-case id="clickhouse_select_interval_and_cast_decimal" value="SELECT
order_time + INTERVAL 2 DAY AS interval_added, CAST(amount AS DATETIME64(10,
2)) AS amount_decimal, (status) AS 'wrapped_status' FROM t_order"
db-types="ClickHouse" />
<sql-case id="clickhouse_select_right_join_subquery" value="SELECT * FROM
(SELECT order_id FROM t_order) sub JOIN t_order_item i ON sub.order_id =
i.order_id" db-types="ClickHouse" />
<sql-case id="clickhouse_select_comma_join" value="SELECT * FROM t_order
o, t_order_item i" db-types="ClickHouse" />
+ <sql-case id="clickhouse_select_or_boolean" value="SELECT * FROM t_order
WHERE status IS TRUE OR amount > 100" db-types="ClickHouse" />
+ <sql-case id="clickhouse_select_is_false" value="SELECT * FROM t_order
WHERE is_deleted IS FALSE" db-types="ClickHouse" />
+ <sql-case id="clickhouse_select_parenthesized_right_cross_join"
value="SELECT * FROM (t_order o RIGHT JOIN t_order_item i ON o.order_id =
i.order_id) CROSS JOIN t_user u" db-types="ClickHouse" />
<sql-case id="clickhouse_update_set_default" value="UPDATE t_order SET
status = DEFAULT WHERE order_id = 1" db-types="ClickHouse" />
<sql-case id="clickhouse_delete_without_where" value="ALTER TABLE t_order
DELETE" db-types="ClickHouse" />
</sql-cases>