HappenLee commented on code in PR #18682:
URL: https://github.com/apache/doris/pull/18682#discussion_r1166659956
##########
be/src/vec/functions/functions_multi_string_position.cpp:
##########
@@ -113,38 +126,50 @@ struct FunctionMultiSearchAllPositionsImpl {
const ColumnString::Offsets&
haystack_offsets,
const Array& needles_arr,
PaddedPODArray<Int32>& vec_res,
PaddedPODArray<UInt64>& offsets_res) {
- if (needles_arr.size() > std::numeric_limits<UInt8>::max())
+ if (needles_arr.size() > std::numeric_limits<UInt8>::max()) {
return Status::InvalidArgument(
"number of arguments for function {} doesn't match: "
"passed {}, should be at most 255",
name, needles_arr.size());
+ }
std::vector<StringRef> needles;
needles.reserve(needles_arr.size());
- for (const auto& needle : needles_arr)
needles.emplace_back(needle.get<StringRef>());
-
- auto res_callback = [](const UInt8* start, const UInt8* end) -> Int32 {
- return 1 + Impl::count_chars(reinterpret_cast<const char*>(start),
- reinterpret_cast<const char*>(end));
- };
-
- auto searcher = Impl::create_multi_searcher(needles);
+ for (const auto& needle : needles_arr) {
+ needles.emplace_back(needle.get<StringRef>());
+ }
- const size_t haystack_size = haystack_offsets.size();
const size_t needles_size = needles.size();
+ std::vector<SingleSearcher> searchers;
+ searchers.reserve(needles_size);
+ for (auto needle : needles) {
+ searchers.emplace_back(needle.data, needle.size);
Review Comment:
why do the work in up for-loop ?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]