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 | | #include <vector> |
22 | | |
23 | | #include "common/object_pool.h" |
24 | | #include "common/status.h" |
25 | | #include "core/field.h" |
26 | | #include "exprs/function/function.h" |
27 | | #include "exprs/function_context.h" |
28 | | #include "exprs/vexpr.h" |
29 | | |
30 | | namespace doris { |
31 | | class RowDescriptor; |
32 | | class RuntimeState; |
33 | | class TExprNode; |
34 | | class Block; |
35 | | class VExprContext; |
36 | | } // namespace doris |
37 | | |
38 | | namespace doris { |
39 | | class VInPredicate MOCK_REMOVE(final) : public VExpr { |
40 | | ENABLE_FACTORY_CREATOR(VInPredicate); |
41 | | |
42 | | public: |
43 | | VInPredicate(const TExprNode& node); |
44 | | #ifdef BE_TEST |
45 | | VInPredicate() = default; |
46 | | #endif |
47 | 1.22k | ~VInPredicate() override = default; |
48 | | Status execute_column_impl(VExprContext* context, const Block* block, const Selector* selector, |
49 | | size_t count, ColumnPtr& result_column) const override; |
50 | | size_t estimate_memory(const size_t rows) override; |
51 | | Status prepare(RuntimeState* state, const RowDescriptor& desc, VExprContext* context) override; |
52 | | Status open(RuntimeState* state, VExprContext* context, |
53 | | FunctionContext::FunctionStateScope scope) override; |
54 | | void close(VExprContext* context, FunctionContext::FunctionStateScope scope) override; |
55 | | const std::string& expr_name() const override; |
56 | | |
57 | | std::string debug_string() const override; |
58 | | |
59 | 0 | const FunctionBasePtr function() { return _function; } |
60 | | |
61 | 1.43k | bool is_not_in() const { return _is_not_in; }; |
62 | | Status evaluate_inverted_index(VExprContext* context, uint32_t segment_num_rows) override; |
63 | | ZoneMapFilterResult evaluate_zonemap_filter(const ZoneMapEvalContext& ctx) const override; |
64 | | |
65 | 1.52k | uint64_t get_digest(uint64_t seed) const override { return 0; } |
66 | | |
67 | | private: |
68 | | Status _materialize_for_zonemap_filter(); |
69 | | |
70 | | FunctionBasePtr _function; |
71 | | std::string _expr_name; |
72 | | |
73 | | MOCK_REMOVE(const) bool _is_not_in; |
74 | | static const constexpr char* function_name = "in"; |
75 | | uint32_t _in_list_value_count_threshold = 10; |
76 | | bool _is_args_all_constant = false; |
77 | | bool _zonemap_materialized = false; |
78 | | bool _seg_filter_contains_null = false; |
79 | | std::vector<Field> _seg_filter_values; |
80 | | Field _seg_filter_min; |
81 | | Field _seg_filter_max; |
82 | | }; |
83 | | } // namespace doris |