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 4edfbb5c76a [fix](nereids)modify split_part function to fold to null 
literal with correct data type (#42100)
4edfbb5c76a is described below

commit 4edfbb5c76a563e6311f7283273877b3d0fbcd74
Author: starocean999 <[email protected]>
AuthorDate: Fri Oct 18 22:15:57 2024 +0800

    [fix](nereids)modify split_part function to fold to null literal with 
correct data type (#42100)
    
    pick from master https://github.com/apache/doris/pull/41109
    
    ## Proposed changes
    
    Issue Number: close #xxx
    
    <!--Describe your changes.-->
---
 .../trees/expressions/functions/executable/StringArithmetic.java     | 2 +-
 .../nereids_p0/sql_functions/string_functions/test_split_part.groovy | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

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 844c37aab49..7d7918766cc 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
@@ -619,7 +619,7 @@ public class StringArithmetic {
                     return castStringLikeLiteral(first, "");
                 }
             }
-            return new NullLiteral();
+            return new NullLiteral(first.getDataType());
         } else if (number.getValue() < 0) {
             StringBuilder result = new 
StringBuilder(parts[Math.abs(number.getValue()) - 1]);
             return castStringLikeLiteral(first, result.reverse().toString());
diff --git 
a/regression-test/suites/nereids_p0/sql_functions/string_functions/test_split_part.groovy
 
b/regression-test/suites/nereids_p0/sql_functions/string_functions/test_split_part.groovy
index 76a8e4af13f..c93349e3cea 100644
--- 
a/regression-test/suites/nereids_p0/sql_functions/string_functions/test_split_part.groovy
+++ 
b/regression-test/suites/nereids_p0/sql_functions/string_functions/test_split_part.groovy
@@ -30,4 +30,9 @@ suite("test_split_part") {
   }
 
   qt_1 "select split_part(k8, '1', 1), k8, split_part(concat(k8, '12'), '1', 
1) from nereids_test_query_db.test order by k8 limit 2;"
+
+  explain {
+        sql("""verbose select split_part(replace_empty('we', "", "u"), ":", 5 
- 5);""")
+        notContains "null_type"
+  }
 }
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to