/root/doris/be/src/exprs/vbloom_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 <memory> |
21 | | #include <string> |
22 | | |
23 | | #include "common/object_pool.h" |
24 | | #include "common/status.h" |
25 | | #include "exprs/function_context.h" |
26 | | #include "exprs/vexpr.h" |
27 | | |
28 | | namespace doris { |
29 | | class BloomFilterFuncBase; |
30 | | class RowDescriptor; |
31 | | class RuntimeState; |
32 | | class TExprNode; |
33 | | class Block; |
34 | | class VExprContext; |
35 | | } // namespace doris |
36 | | |
37 | | namespace doris { |
38 | | class VBloomPredicate final : public VExpr { |
39 | | ENABLE_FACTORY_CREATOR(VBloomPredicate); |
40 | | |
41 | | public: |
42 | | VBloomPredicate(const TExprNode& node); |
43 | 1 | ~VBloomPredicate() override = default; |
44 | | |
45 | | Status execute_column(VExprContext* context, const Block* block, Selector* selector, |
46 | | size_t count, ColumnPtr& result_column) const override; |
47 | | |
48 | | Status execute_runtime_filter(VExprContext* context, const Block* block, |
49 | | const uint8_t* __restrict filter, size_t count, |
50 | | ColumnPtr& result_column, ColumnPtr* arg_column) const override; |
51 | | |
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 | | const std::string& expr_name() const override; |
57 | | void set_filter(std::shared_ptr<BloomFilterFuncBase> filter); |
58 | | |
59 | 0 | std::shared_ptr<BloomFilterFuncBase> get_bloom_filter_func() const override { return _filter; } |
60 | | |
61 | | uint64_t get_digest(uint64_t seed) const override; |
62 | | |
63 | | private: |
64 | | Status _do_execute(VExprContext* context, const Block* block, const uint8_t* __restrict filter, |
65 | | Selector* selector, size_t count, ColumnPtr& result_column) const; |
66 | | |
67 | | std::shared_ptr<BloomFilterFuncBase> _filter; |
68 | | inline static const std::string EXPR_NAME = "bloom_predicate"; |
69 | | }; |
70 | | } // namespace doris |