Coverage Report

Created: 2026-07-29 18:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
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
3.84k
    ~VBloomPredicate() override = default;
44
45
    Status execute_column_impl(VExprContext* context, const Block* block, const 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
    bool can_execute_on_raw_fixed_values(const DataTypePtr& data_type,
53
                                         int column_id) const override;
54
    Status execute_on_raw_fixed_values(const uint8_t* values, size_t num_values, size_t value_width,
55
                                       const DataTypePtr& data_type, int column_id,
56
                                       uint8_t* matches) const override;
57
    bool can_execute_on_raw_binary_values(const DataTypePtr& data_type,
58
                                          int column_id) const override;
59
    Status execute_on_raw_binary_values(const StringRef* values, size_t num_values,
60
                                        const DataTypePtr& data_type, int column_id,
61
                                        uint8_t* matches) const override;
62
    ZoneMapFilterResult evaluate_dictionary_filter(const DictionaryEvalContext& ctx) const override;
63
    bool can_evaluate_dictionary_filter() const override;
64
65
    Status prepare(RuntimeState* state, const RowDescriptor& desc, VExprContext* context) override;
66
    Status open(RuntimeState* state, VExprContext* context,
67
                FunctionContext::FunctionStateScope scope) override;
68
    void close(VExprContext* context, FunctionContext::FunctionStateScope scope) override;
69
    const std::string& expr_name() const override;
70
    void set_filter(std::shared_ptr<BloomFilterFuncBase> filter);
71
72
3.23k
    std::shared_ptr<BloomFilterFuncBase> get_bloom_filter_func() const override { return _filter; }
73
74
    uint64_t get_digest(uint64_t seed) const override;
75
0
    Status clone_node(VExprSPtr* cloned_expr) const override {
76
0
        DORIS_CHECK(cloned_expr != nullptr);
77
0
        auto cloned = VBloomPredicate::create_shared(clone_texpr_node());
78
0
        cloned->set_filter(_filter);
79
0
        *cloned_expr = std::move(cloned);
80
0
        return Status::OK();
81
0
    }
82
83
private:
84
    Status _do_execute(VExprContext* context, const Block* block, const uint8_t* __restrict filter,
85
                       const Selector* selector, size_t count, ColumnPtr& result_column) const;
86
87
    std::shared_ptr<BloomFilterFuncBase> _filter;
88
    inline static const std::string EXPR_NAME = "bloom_predicate";
89
};
90
} // namespace doris