Tanya-W commented on code in PR #14211:
URL: https://github.com/apache/doris/pull/14211#discussion_r1058125040


##########
be/src/exprs/match_predicate.cpp:
##########
@@ -0,0 +1,102 @@
+// 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 "exprs/match_predicate.h"
+
+#include <string.h>
+
+#include <memory>
+#include <sstream>
+
+#include "exec/olap_utils.h"
+#include "exprs/string_functions.h"
+#include "olap/schema.h"
+#include "runtime/string_value.hpp"
+
+namespace doris {
+
+MatchPredicate::MatchPredicate(uint32_t column_id, const std::string& value, 
MatchType match_type)
+        : ColumnPredicate(column_id), _value(value), _match_type(match_type) {}
+
+PredicateType MatchPredicate::type() const {
+    return PredicateType::MATCH;
+}
+
+Status MatchPredicate::evaluate(const Schema& schema, InvertedIndexIterator* 
iterator,
+                            uint32_t num_rows, roaring::Roaring* bitmap) const 
{
+    if (iterator == nullptr) {
+        return Status::OK();
+    }
+    auto column_desc = schema.column(_column_id);
+    roaring::Roaring roaring;
+    Status s = Status::OK();
+    auto inverted_index_query_type = 
_to_inverted_index_query_type(_match_type);
+
+    if (is_string_type(column_desc->type()) ||
+        (column_desc->type() == OLAP_FIELD_TYPE_ARRAY &&
+         is_string_type(column_desc->get_sub_field(0)->type_info()->type()))) {
+        StringValue match_value;
+        int32_t length = _value.length();
+        char* buffer = const_cast<char*>(_value.c_str());
+        match_value.replace(buffer, length);
+        s = iterator->read_from_inverted_index(column_desc->name(), 
&match_value,
+                                               inverted_index_query_type, 
num_rows, &roaring);
+    } else if (column_desc->type() == OLAP_FIELD_TYPE_ARRAY &&

Review Comment:
   MatchPredicate not evaluate numeric_type column, numeric_type in array 
evaluate here because the implementation logic is simple



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