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 9de314c4252 Add more test cases on Doris SQL parser (#37689)
9de314c4252 is described below
commit 9de314c425284a6e1bc548ddfb2447bd908b4561
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Jan 8 18:41:13 2026 +0800
Add more test cases on Doris SQL parser (#37689)
---
.../main/resources/case/dml/select-expression.xml | 44 +++++++++++++++++
.../parser/src/main/resources/case/dml/select.xml | 57 ++++++++++++++++++++++
.../sql/supported/dml/select-expression.xml | 2 +
.../main/resources/sql/supported/dml/select.xml | 3 ++
4 files changed, 106 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 d1f0b949451..1c5c7478cd1 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
@@ -76,6 +76,50 @@
</projections>
</select>
+ <select sql-case-id="select_where_is_true_doris">
+ <from>
+ <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="flag" start-index="28" stop-index="31" />
+ </left>
+ <operator>IS</operator>
+ <right>
+ <literal-expression value="TRUE" start-index="36"
stop-index="39" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </where>
+ </select>
+
+ <select sql-case-id="select_where_is_false_doris">
+ <from>
+ <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="40">
+ <expr>
+ <binary-operation-expression start-index="28" stop-index="40">
+ <left>
+ <column name="flag" start-index="28" stop-index="31" />
+ </left>
+ <operator>IS</operator>
+ <right>
+ <literal-expression value="FALSE" start-index="36"
stop-index="40" />
+ </right>
+ </binary-operation-expression>
+ </expr>
+ </where>
+ </select>
+
<select sql-case-id="select_case_when_with_mul_condition">
<projections start-index="7" stop-index="52">
<expression-projection text="case 1*0 when "a" then
"true" else "false" END" start-index="7" stop-index="52">
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 abf7f555b9f..c85dc2d6786 100644
--- a/test/it/parser/src/main/resources/case/dml/select.xml
+++ b/test/it/parser/src/main/resources/case/dml/select.xml
@@ -9884,6 +9884,38 @@
</from>
</select>
+ <select sql-case-id="select_with_index_hint_for_order_by_doris">
+ <projections start-index="7" stop-index="7">
+ <shorthand-projection start-index="7" stop-index="7" />
+ </projections>
+ <from>
+ <simple-table name="t1" start-index="14" stop-index="15">
+ <index-hint origin-text="USE INDEX FOR ORDER BY (i1)"
start-index="17" stop-index="43">
+ <hint-index-name name="i1" start-index="41"
stop-index="42" />
+ </index-hint>
+ </simple-table>
+ </from>
+ <order-by>
+ <column-item name="col1" start-index="54" stop-index="57" />
+ </order-by>
+ </select>
+
+ <select sql-case-id="select_with_index_hint_for_group_by_doris">
+ <projections start-index="7" stop-index="7">
+ <shorthand-projection start-index="7" stop-index="7" />
+ </projections>
+ <from>
+ <simple-table name="t1" start-index="14" stop-index="15">
+ <index-hint origin-text="USE INDEX FOR GROUP BY (i1)"
start-index="17" stop-index="43">
+ <hint-index-name name="i1" start-index="41"
stop-index="42" />
+ </index-hint>
+ </simple-table>
+ </from>
+ <group-by>
+ <column-item name="col1" start-index="54" stop-index="57" />
+ </group-by>
+ </select>
+
<select sql-case-id="select_with_force_index_for_order_by">
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
@@ -10265,6 +10297,31 @@
</where>
</select>
+ <select sql-case-id="select_not_match_against_doris">
+ <projections start-index="7" stop-index="7">
+ <shorthand-projection start-index="7" stop-index="7" />
+ </projections>
+ <from start-index="14" stop-index="20">
+ <simple-table name="t_order" start-index="14" stop-index="20" />
+ </from>
+ <where start-index="22" stop-index="89">
+ <expr start-index="28" stop-index="89">
+ <not-expression start-index="28" stop-index="89">
+ <expr start-index="32" stop-index="89">
+ <match-expression start-index="32" stop-index="89">
+ <columns>
+ <column name="description" start-index="38"
stop-index="48" />
+ </columns>
+ <expr start-index="59" stop-index="63">
+ <literal-expression value="abc"
start-index="59" stop-index="63" />
+ </expr>
+ </match-expression>
+ </expr>
+ </not-expression>
+ </expr>
+ </where>
+ </select>
+
<select sql-case-id="select_with_oracle_v1_keyword">
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7">
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 60589306266..38d0a3654ee 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
@@ -105,6 +105,8 @@
<sql-case id="select_with_collate_with_marker" value="SELECT * FROM
t_order WHERE order_id COLLATE ?" db-types="MySQL,Presto,Doris" />
<sql-case id="select_safe_equal" value="SELECT 1 <=> 1"
db-types="Doris" />
+ <sql-case id="select_where_is_true_doris" value="SELECT * FROM t_order
WHERE flag IS TRUE" db-types="Doris" />
+ <sql-case id="select_where_is_false_doris" value="SELECT * FROM t_order
WHERE flag IS FALSE" db-types="Doris" />
<sql-case id="select_string_concat_with_double_bar" value="SELECT 'a' ||
'b'" db-types="Doris" />
<sql-case id="select_age_for_postgres" value="SELECT * FROM
cypher('sharding_test_1', $$ CREATE (n) $$) as (a agtype)"
db-types="PostgreSQL" />
<sql-case id="select_datetime_expression" value="SELECT SYSTIMESTAMP AT
TIME ZONE 'UTC' FROM DUAL;" db-types="Oracle" />
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 e84f715a416..f908843d31d 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
@@ -90,6 +90,7 @@
<sql-case id="select_with_spatial_function" value="SELECT * FROM t_order
WHERE ST_DISTANCE_SPHERE(POINT(113.358772, 23.1273723),
POINT(user_id,order_id)) != 0" db-types="MySQL" />
<sql-case id="select_current_user" value="SELECT CURRENT_USER"
db-types="PostgreSQL,openGauss" />
<sql-case id="select_with_match_against" value="SELECT * FROM t_order_item
WHERE MATCH(t_order_item.description) AGAINST (? IN NATURAL LANGUAGE MODE) AND
user_id = ?" db-types="MySQL,Doris" />
+ <sql-case id="select_not_match_against_doris" value="SELECT * FROM t_order
WHERE NOT MATCH(description) AGAINST('abc' IN NATURAL LANGUAGE MODE)"
db-types="Doris" />
<sql-case id="select_straight_join_doris" value="SELECT STRAIGHT_JOIN *
FROM t_order" db-types="Doris" />
<sql-case id="select_for_update_doris" value="SELECT * FROM t_order FOR
UPDATE" db-types="Doris" />
<sql-case id="select_union_doris" value="SELECT 1 UNION SELECT 2"
db-types="Doris" />
@@ -317,6 +318,8 @@
<sql-case id="select_with_index_hints1" value="SELECT * FROM t1 USE INDEX
(i1) IGNORE INDEX (i2) USE INDEX (i2);" db-types="MySQL,Doris"/>
<sql-case id="select_with_index_hints2" value="SELECT * FROM t1 USE INDEX
() IGNORE INDEX (i2) USE INDEX (i1) USE INDEX (i2);" db-types="MySQL,Doris"/>
<sql-case id="select_with_index_hints3" value="SELECT * FROM t1 USE INDEX
(i1,i2) IGNORE INDEX (i2);" db-types="MySQL,Doris"/>
+ <sql-case id="select_with_index_hint_for_order_by_doris" value="SELECT *
FROM t1 USE INDEX FOR ORDER BY (i1) ORDER BY col1" db-types="Doris"/>
+ <sql-case id="select_with_index_hint_for_group_by_doris" value="SELECT *
FROM t1 USE INDEX FOR GROUP BY (i1) GROUP BY col1" db-types="Doris"/>
<sql-case id="select_with_force_index_for_order_by" value="SELECT * FROM
t1 FORCE INDEX FOR ORDER BY (idx1) ORDER BY id" db-types="MySQL,Doris" />
<sql-case id="select_with_force_index_for_group_by" value="SELECT * FROM
t1 FORCE INDEX FOR GROUP BY (idx1) GROUP BY id" db-types="MySQL,Doris" />
<sql-case id="select_with_force_index_for_join" value="SELECT * FROM t1
FORCE INDEX FOR JOIN (idx1)" db-types="MySQL,Doris" />