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

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


The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
     new 89edd0731d [Bug](function) fix substr return null on row-based engine 
#12906
89edd0731d is described below

commit 89edd0731d2072f9304fc47b6136d26089dadfde
Author: Pxl <pxl...@qq.com>
AuthorDate: Tue Sep 27 08:47:32 2022 +0800

    [Bug](function) fix substr return null on row-based engine #12906
---
 be/src/exprs/string_functions.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/be/src/exprs/string_functions.cpp 
b/be/src/exprs/string_functions.cpp
index f2ccb577ae..520ba762e6 100644
--- a/be/src/exprs/string_functions.cpp
+++ b/be/src/exprs/string_functions.cpp
@@ -49,10 +49,10 @@ size_t get_char_len(const StringVal& str, 
std::vector<size_t>* str_index) {
 //  - [optional] len.  No len indicates longest substr possible
 StringVal StringFunctions::substring(FunctionContext* context, const 
StringVal& str,
                                      const IntVal& pos, const IntVal& len) {
-    if (str.is_null || pos.is_null || len.is_null || pos.val > str.len) {
+    if (str.is_null || pos.is_null || len.is_null) {
         return StringVal::null();
     }
-    if (len.val <= 0 || str.len == 0 || pos.val == 0) {
+    if (len.val <= 0 || str.len == 0 || pos.val == 0 || pos.val > str.len) {
         return StringVal();
     }
 


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

Reply via email to