This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 a14fa59423c Support Doris SQL - SPLIT_BY_STRING Statement (#39056)
a14fa59423c is described below
commit a14fa59423cd16b75e081e680417e199377eac3d
Author: ilyas ahsan <[email protected]>
AuthorDate: Tue Jul 14 11:11:34 2026 +0700
Support Doris SQL - SPLIT_BY_STRING Statement (#39056)
* Support Doris SQL - Split By String Statement
* Preserve expression arguments in SPLIT_BY_STRING
remove comment
* Parse SPLIT_BY_STRING via generic function path
* Add SQL cases for SPLIT_BY_STRING with placeholders and nested functions
in Doris
---
.../resources/case/dml/select-special-function.xml | 84 ++++++++++++++++++++++
.../sql/supported/dml/select-special-function.xml | 4 ++
2 files changed, 88 insertions(+)
diff --git
a/test/it/parser/src/main/resources/case/dml/select-special-function.xml
b/test/it/parser/src/main/resources/case/dml/select-special-function.xml
index 03276021488..7cb8784af67 100644
--- a/test/it/parser/src/main/resources/case/dml/select-special-function.xml
+++ b/test/it/parser/src/main/resources/case/dml/select-special-function.xml
@@ -6132,4 +6132,88 @@
<simple-table name="t_order" start-index="29" stop-index="35" />
</from>
</select>
+
+ <select sql-case-id="select_split_by_string" db-types="Doris">
+ <projections start-index="7" stop-index="52">
+ <expression-projection start-index="7" stop-index="52"
text="SPLIT_BY_STRING('apple::banana::cherry', '::')">
+ <expr>
+ <function function-name="SPLIT_BY_STRING"
text="SPLIT_BY_STRING('apple::banana::cherry', '::')" start-index="7"
stop-index="52">
+ <parameter>
+ <literal-expression value="apple::banana::cherry"
start-index="23" stop-index="45" />
+ </parameter>
+ <parameter>
+ <literal-expression value="::" start-index="48"
stop-index="51" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ </select>
+
+ <select sql-case-id="select_split_by_string_with_column" db-types="Doris">
+ <projections start-index="7" stop-index="40">
+ <expression-projection start-index="7" stop-index="40"
text="SPLIT_BY_STRING(order_notes, '::')">
+ <expr>
+ <function function-name="SPLIT_BY_STRING"
text="SPLIT_BY_STRING(order_notes, '::')" start-index="7" stop-index="40">
+ <parameter>
+ <column name="order_notes" start-index="23"
stop-index="33" />
+ </parameter>
+ <parameter>
+ <literal-expression value="::" start-index="36"
stop-index="39" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ <from>
+ <simple-table name="t_order" start-index="47" stop-index="53" />
+ </from>
+ </select>
+
+ <select sql-case-id="select_split_by_string_with_placeholder"
db-types="Doris" parameters="'a::b::c', '::'">
+ <projections start-index="7" stop-index="27">
+ <expression-projection start-index="7" stop-index="27"
text="SPLIT_BY_STRING(?, ?)">
+ <expr>
+ <function function-name="SPLIT_BY_STRING"
text="SPLIT_BY_STRING(?, ?)" start-index="7" stop-index="27">
+ <parameter>
+ <parameter-marker-expression parameter-index="0"
start-index="23" stop-index="23" />
+ </parameter>
+ <parameter>
+ <parameter-marker-expression parameter-index="1"
start-index="26" stop-index="26" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ <from>
+ <simple-table name="t_order" start-index="34" stop-index="40" />
+ </from>
+ </select>
+
+ <select sql-case-id="select_split_by_string_with_nested_function"
db-types="Doris">
+ <projections start-index="7" stop-index="53">
+ <expression-projection start-index="7" stop-index="53"
text="SPLIT_BY_STRING(CONCAT(order_notes, '-'), '::')">
+ <expr>
+ <function function-name="SPLIT_BY_STRING"
text="SPLIT_BY_STRING(CONCAT(order_notes, '-'), '::')" start-index="7"
stop-index="53">
+ <parameter>
+ <function function-name="CONCAT"
text="CONCAT(order_notes, '-')" start-index="23" stop-index="46">
+ <parameter>
+ <column name="order_notes"
start-index="30" stop-index="40" />
+ </parameter>
+ <parameter>
+ <literal-expression value="-"
start-index="43" stop-index="45" />
+ </parameter>
+ </function>
+ </parameter>
+ <parameter>
+ <literal-expression value="::" start-index="49"
stop-index="52" />
+ </parameter>
+ </function>
+ </expr>
+ </expression-projection>
+ </projections>
+ <from>
+ <simple-table name="t_order" start-index="60" stop-index="66" />
+ </from>
+ </select>
</sql-parser-test-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/dml/select-special-function.xml
b/test/it/parser/src/main/resources/sql/supported/dml/select-special-function.xml
index 9c732281728..5a1c86cf792 100644
---
a/test/it/parser/src/main/resources/sql/supported/dml/select-special-function.xml
+++
b/test/it/parser/src/main/resources/sql/supported/dml/select-special-function.xml
@@ -343,4 +343,8 @@
<sql-case id="select_cast_with_placeholder_clickhouse" value="SELECT
CAST(? AS INT8) FROM t_order" case-types="placeholder" db-types="ClickHouse" />
<sql-case id="select_cast_with_placeholder_standard" value="SELECT CAST(?
AS INT) FROM t_order" case-types="placeholder"
db-types="SQL92,Firebird,SQLServer" />
<sql-case id="select_interval_with_placeholder" value="SELECT INTERVAL ?
DAY FROM t_order" case-types="placeholder"
db-types="MySQL,ClickHouse,SQL92,Firebird" />
+ <sql-case id="select_split_by_string" value="SELECT
SPLIT_BY_STRING('apple::banana::cherry', '::')" db-types="Doris" />
+ <sql-case id="select_split_by_string_with_column" value="SELECT
SPLIT_BY_STRING(order_notes, '::') FROM t_order" db-types="Doris" />
+ <sql-case id="select_split_by_string_with_placeholder" value="SELECT
SPLIT_BY_STRING(?, ?) FROM t_order" case-types="placeholder" db-types="Doris" />
+ <sql-case id="select_split_by_string_with_nested_function" value="SELECT
SPLIT_BY_STRING(CONCAT(order_notes, '-'), '::') FROM t_order" db-types="Doris"
/>
</sql-cases>