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

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


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

commit cdbb07a57a4538fd216abd39a00747c645a86325
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Mar 15 10:11:32 2025 +0800

    branch-3.0: [fix](Nereids) fix split part with regex not exist in source 
string #48895 (#48909)
    
    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 799bbb7585c..3a903308824 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
@@ -700,6 +700,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 74e5b60bff6..9f70f3f51aa 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
@@ -592,6 +592,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