From 12d6efa92b6e00f857b651cc5cebed11cdef00b3 Mon Sep 17 00:00:00 2001 From: Pxl Date: Tue, 27 Sep 2022 08:47:32 +0800 Subject: [PATCH] [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* 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(); }