/root/doris/be/src/exprs/vmatch_predicate.h
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #pragma once |
19 | | |
20 | | #include <string> |
21 | | |
22 | | #include "common/object_pool.h" |
23 | | #include "common/status.h" |
24 | | #include "exprs/function/function.h" |
25 | | #include "exprs/function_context.h" |
26 | | #include "exprs/vexpr.h" |
27 | | #include "storage/index/inverted/inverted_index_parser.h" |
28 | | |
29 | | namespace lucene { |
30 | | namespace analysis { |
31 | | class Analyzer; |
32 | | } |
33 | | } // namespace lucene |
34 | | namespace doris { |
35 | | class RowDescriptor; |
36 | | class RuntimeState; |
37 | | class TExprNode; |
38 | | class Block; |
39 | | class VExprContext; |
40 | | } // namespace doris |
41 | | |
42 | | namespace doris { |
43 | | |
44 | | class VMatchPredicate final : public VExpr { |
45 | | ENABLE_FACTORY_CREATOR(VMatchPredicate); |
46 | | |
47 | | public: |
48 | | VMatchPredicate(const TExprNode& node); |
49 | | ~VMatchPredicate() override; |
50 | | Status execute_column(VExprContext* context, const Block* block, Selector* selector, |
51 | | size_t count, ColumnPtr& result_column) const override; |
52 | | Status prepare(RuntimeState* state, const RowDescriptor& desc, VExprContext* context) override; |
53 | | Status open(RuntimeState* state, VExprContext* context, |
54 | | FunctionContext::FunctionStateScope scope) override; |
55 | | void close(VExprContext* context, FunctionContext::FunctionStateScope scope) override; |
56 | | Status evaluate_inverted_index(VExprContext* context, uint32_t segment_num_rows) override; |
57 | | const std::string& expr_name() const override; |
58 | | const std::string& function_name() const; |
59 | | [[nodiscard]] const std::string& get_analyzer_key() const override; |
60 | | |
61 | | std::string debug_string() const override; |
62 | | |
63 | 0 | FunctionBasePtr function() { return _function; } |
64 | | |
65 | | private: |
66 | | FunctionBasePtr _function; |
67 | | std::string _expr_name; |
68 | | std::string _function_name; |
69 | | |
70 | | // Lifecycle management: holds ownership of the analyzer |
71 | | std::shared_ptr<lucene::analysis::Analyzer> _analyzer; |
72 | | |
73 | | // Runtime context: holds raw pointer to analyzer and necessary runtime info |
74 | | InvertedIndexAnalyzerCtxSPtr _analyzer_ctx; |
75 | | }; |
76 | | } // namespace doris |