/root/doris/be/src/exprs/vbitmap_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 <fmt/format.h> |
21 | | |
22 | | #include <memory> |
23 | | #include <string> |
24 | | |
25 | | #include "common/object_pool.h" |
26 | | #include "common/status.h" |
27 | | #include "exprs/function_context.h" |
28 | | #include "exprs/vexpr.h" |
29 | | |
30 | | namespace doris { |
31 | | class BitmapFilterFuncBase; |
32 | | class RowDescriptor; |
33 | | class RuntimeState; |
34 | | class TExprNode; |
35 | | class Block; |
36 | | class VExprContext; |
37 | | } // namespace doris |
38 | | |
39 | | namespace doris { |
40 | | |
41 | | // used for bitmap runtime filter |
42 | | class VBitmapPredicate final : public VExpr { |
43 | | ENABLE_FACTORY_CREATOR(VBitmapPredicate); |
44 | | |
45 | | public: |
46 | | VBitmapPredicate(const TExprNode& node); |
47 | | |
48 | 0 | ~VBitmapPredicate() override = default; |
49 | | |
50 | | Status execute_column(VExprContext* context, const Block* block, Selector* selector, |
51 | | size_t count, ColumnPtr& result_column) const override; |
52 | | Status execute_runtime_filter(VExprContext* context, const Block* block, |
53 | | const uint8_t* __restrict filter, size_t count, |
54 | | ColumnPtr& result_column, ColumnPtr* arg_column) const override; |
55 | | Status prepare(RuntimeState* state, const RowDescriptor& desc, VExprContext* context) override; |
56 | | |
57 | | Status open(RuntimeState* state, VExprContext* context, |
58 | | FunctionContext::FunctionStateScope scope) override; |
59 | | |
60 | | void close(VExprContext* context, FunctionContext::FunctionStateScope scope) override; |
61 | | |
62 | | const std::string& expr_name() const override; |
63 | | |
64 | | void set_filter(std::shared_ptr<BitmapFilterFuncBase> filter); |
65 | | |
66 | 0 | std::shared_ptr<BitmapFilterFuncBase> get_bitmap_filter_func() const override { |
67 | 0 | return _filter; |
68 | 0 | } |
69 | | |
70 | 0 | std::string debug_string() const override { |
71 | 0 | return fmt::format(" VBitmapPredicate:{}", VExpr::debug_string()); |
72 | 0 | } |
73 | | |
74 | | // not need support bitmap filter get_digest |
75 | 0 | uint64_t get_digest(uint64_t seed) const override { return 0; } |
76 | | |
77 | | private: |
78 | | Status _do_execute(VExprContext* context, const Block* block, const uint8_t* __restrict filter, |
79 | | Selector* selector, size_t count, ColumnPtr& result_column) const; |
80 | | std::shared_ptr<BitmapFilterFuncBase> _filter; |
81 | | inline static const std::string EXPR_NAME = "bitmap_predicate"; |
82 | | }; |
83 | | } // namespace doris |