github-actions[bot] commented on code in PR #37722:
URL: https://github.com/apache/doris/pull/37722#discussion_r1684508975


##########
be/src/vec/functions/function_multi_match.cpp:
##########
@@ -0,0 +1,189 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "vec/functions/function_multi_match.h"
+
+#include <gen_cpp/PaloBrokerService_types.h>
+#include <glog/logging.h>
+
+#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/classification.hpp>
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+#include <roaring/roaring.hh>
+#include <string>
+#include <vector>
+
+#include "io/fs/file_reader.h"
+#include "olap/olap_common.h"
+#include "olap/rowset/segment_v2/inverted_index/query/phrase_prefix_query.h"
+#include "olap/rowset/segment_v2/segment_iterator.h"
+#include "runtime/primitive_type.h"
+#include "vec/columns/column.h"
+#include "vec/data_types/data_type.h"
+#include "vec/exprs/varray_literal.h"
+#include "vec/exprs/vexpr.h"
+#include "vec/exprs/vslot_ref.h"
+#include "vec/functions/simple_function_factory.h"
+
+namespace doris::vectorized {
+
+Status FunctionMultiMatch::execute_impl(FunctionContext* /*context*/, Block& 
block,
+                                        const ColumnNumbers& arguments, size_t 
result,
+                                        size_t /*input_rows_count*/) const {
+    return Status::RuntimeError("only inverted index queries are supported");
+}
+
+Status FunctionMultiMatch::open(FunctionContext* context,
+                                FunctionContext::FunctionStateScope scope) {
+    if (scope == FunctionContext::THREAD_LOCAL) {
+        return Status::OK();
+    }
+
+    DCHECK(context->get_num_args() == 4);
+    for (int i = 0; i < context->get_num_args(); ++i) {
+        DCHECK(is_string_type(context->get_arg_type(i)->type));
+    }
+
+    std::shared_ptr<MatchParam> state = std::make_shared<MatchParam>();
+    context->set_function_state(scope, state);
+    for (int i = 0; i < context->get_num_args(); ++i) {
+        const auto& const_column_ptr = context->get_constant_col(i);
+        if (const_column_ptr) {
+            auto const_data = const_column_ptr->column_ptr->get_data_at(0);
+            switch (i) {
+            case 1: {
+                std::string field_names_str = const_data.to_string();
+                field_names_str.erase(
+                        std::remove_if(field_names_str.begin(), 
field_names_str.end(),
+                                       [](unsigned char c) { return 
std::isspace(c); }),
+                        field_names_str.end());
+                std::vector<std::string> field_names;
+                boost::split(field_names, field_names_str, 
boost::algorithm::is_any_of(","));
+                state->fields.insert(field_names.begin(), field_names.end());
+            } break;
+            case 2:
+                state->type = const_data.to_string();
+                break;
+            case 3:
+                state->query = const_data.to_string();
+                break;
+            default:
+                break;
+            }
+        }
+    }
+
+    return Status::OK();
+}
+
+Status FunctionMultiMatch::eval_inverted_index(FunctionContext* context,

Review Comment:
   warning: function 'eval_inverted_index' exceeds recommended size/complexity 
thresholds [readability-function-size]
   ```cpp
   Status FunctionMultiMatch::eval_inverted_index(FunctionContext* context,
                              ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/src/vec/functions/function_multi_match.cpp:94:** 86 lines including 
whitespace and comments (threshold 80)
   ```cpp
   Status FunctionMultiMatch::eval_inverted_index(FunctionContext* context,
                              ^
   ```
   
   </details>
   



-- 
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

Reply via email to