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

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


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

commit 12d6efa92b6e00f857b651cc5cebed11cdef00b3
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 32a4261e41..2f3abd2e8e 100644
--- a/be/src/exprs/string_functions.cpp
+++ b/be/src/exprs/string_functions.cpp
@@ -50,10 +50,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