HappenLee commented on code in PR #50149: URL: https://github.com/apache/doris/pull/50149#discussion_r2050499140
########## be/src/vec/functions/function_string.h: ########## @@ -1879,21 +1887,20 @@ class FunctionSubstringIndex : public IFunction { res_chars, res_offsets); } } - } - } else { - // if part_number is negative - part_number = -part_number; - for (size_t i = 0; i < input_rows_count; ++i) { - auto str = str_col->get_data_at(i); + } else { + int neg_part_number = -part_number; auto str_str = str.to_string(); int32_t offset = str.size; int32_t pre_offset = offset; int32_t num = 0; auto substr = str_str; - while (num <= part_number && offset >= 0) { - offset = (int)substr.rfind(delimiter, offset); + + std::string delimiter_str(reinterpret_cast<const char*>(delimiter.data), Review Comment: why not use `StringRef` of `std::string_view` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org