[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.-->
This commit is contained in:
@ -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());
|
||||
|
||||
@ -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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user