zhiqiang-hhhh commented on code in PR #41681: URL: https://github.com/apache/doris/pull/41681#discussion_r1797631130
########## be/src/vec/functions/function_string.cpp: ########## @@ -535,6 +545,42 @@ struct TrimUtil { return Status::OK(); } }; +template <bool is_ltrim_in, bool is_rtrim_in, bool trim_single> +struct TrimInUtil { + static Status vector(const ColumnString::Chars& str_data, + const ColumnString::Offsets& str_offsets, const StringRef& remove_str, + ColumnString::Chars& res_data, ColumnString::Offsets& res_offsets) { + const size_t offset_size = str_offsets.size(); + res_offsets.resize(offset_size); + res_data.reserve(str_data.size()); + std::bitset<256> char_lookup; Review Comment: Add comment to explain magic number 256 ########## be/src/vec/functions/function_string.cpp: ########## @@ -535,6 +545,42 @@ struct TrimUtil { return Status::OK(); } }; +template <bool is_ltrim_in, bool is_rtrim_in, bool trim_single> +struct TrimInUtil { + static Status vector(const ColumnString::Chars& str_data, + const ColumnString::Offsets& str_offsets, const StringRef& remove_str, + ColumnString::Chars& res_data, ColumnString::Offsets& res_offsets) { + const size_t offset_size = str_offsets.size(); + res_offsets.resize(offset_size); + res_data.reserve(str_data.size()); + std::bitset<256> char_lookup; + for (size_t i = 0; i < remove_str.size; ++i) { + char_lookup[static_cast<unsigned char>(remove_str.data[i])] = true; Review Comment: what if chinese -- 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