This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 2c358a1464b branch-2.1: [fix](Nereids) fix split part with regex not 
exist in source string #48895 (#48910)
2c358a1464b is described below

commit 2c358a1464b9a729bcd90704ed284deb66b9b6be
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Mar 11 17:37:50 2025 +0800

    branch-2.1: [fix](Nereids) fix split part with regex not exist in source 
string #48895 (#48910)
    
    Cherry-picked from #48895
    
    Co-authored-by: LiBinfeng <libinf...@selectdb.com>
---
 .../trees/expressions/functions/executable/StringArithmetic.java       | 3 +++
 .../expression/fold_constant/fold_constant_string_arithmatic.groovy    | 3 +++
 2 files changed, 6 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
index df6d60ccc36..bc3317ea8d7 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
@@ -702,6 +702,9 @@ public class StringArithmetic {
                 return new NullLiteral(first.getDataType());
             }
         }
+        if (!first.getValue().contains(chr.getValue())) {
+            return new NullLiteral(first.getDataType());
+        }
         String separator = chr.getValue();
         String[] parts;
         if (number.getValue() < 0) {
diff --git 
a/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy
 
b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy
index 64ed3e6ce65..734094eab86 100644
--- 
a/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy
+++ 
b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy
@@ -582,6 +582,9 @@ suite("fold_constant_string_arithmatic") {
     testFoldConst("SELECT 
split_part('a..b\$\$c||d((e))f[[g{{h^^i??j**k++l\\\\m','**', 2)")
     testFoldConst("SELECT 
split_part('a..b\$\$c||d((e))f[[g{{h^^i??j**k++l\\\\m','++', 2)")
     testFoldConst("SELECT 
split_part('a..b\$\$c||d((e))f[[g{{h^^i??j**k++l\\\\m','\\\\', 2)")
+    testFoldConst("select split_part('abc', ':', -1)")
+    testFoldConst("select split_part('abc', ':', 0)")
+    testFoldConst("select split_part('abc', ':', 1)")
 
     // starts_with
     testFoldConst("select starts_with('hello world','hello')")


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to