Coverage Report

Created: 2026-08-24 14:48

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/vin_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
#include <utility>
23
24
#include "common/object_pool.h"
25
#include "common/status.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
class HybridSetBase;
37
struct HybridSetMinMax;
38
} // namespace doris
39
40
namespace doris {
41
class VInPredicate MOCK_REMOVE(final) : public VExpr {
42
    ENABLE_FACTORY_CREATOR(VInPredicate);
43
44
public:
45
    VInPredicate(const TExprNode& node);
46
#ifdef BE_TEST
47
    VInPredicate();
48
#endif
49
1.33k
    ~VInPredicate() override = default;
50
    Status execute_column_impl(VExprContext* context, const Block* block, const Selector* selector,
51
                               size_t count, ColumnPtr& result_column) const override;
52
    size_t estimate_memory(const size_t rows) override;
53
    Status prepare(RuntimeState* state, const RowDescriptor& desc, VExprContext* context) override;
54
    Status open(RuntimeState* state, VExprContext* context,
55
                FunctionContext::FunctionStateScope scope) override;
56
    void close(VExprContext* context, FunctionContext::FunctionStateScope scope) override;
57
    const std::string& expr_name() const override;
58
59
    std::string debug_string() const override;
60
61
0
    FunctionBasePtr function() const { return _function; }
62
63
1.34k
    bool is_not_in() const { return _is_not_in; };
64
    Status evaluate_inverted_index(VExprContext* context, uint32_t segment_num_rows) override;
65
    ZoneMapFilterResult evaluate_zonemap_filter(const ZoneMapEvalContext& ctx) const override;
66
    bool can_evaluate_zonemap_filter() const override;
67
    ZoneMapFilterResult evaluate_dictionary_filter(const DictionaryEvalContext& ctx) const override;
68
    bool can_evaluate_dictionary_filter() const override;
69
    ZoneMapFilterResult evaluate_bloom_filter(const BloomFilterEvalContext& ctx) const override;
70
    bool can_evaluate_bloom_filter() const override;
71
72
    bool can_execute_on_raw_fixed_values(const DataTypePtr& data_type,
73
                                         int column_id) const override;
74
    Status execute_on_raw_fixed_values(const uint8_t* values, size_t num_values, size_t value_width,
75
                                       const DataTypePtr& data_type, int column_id,
76
                                       uint8_t* matches) const override;
77
    bool can_execute_on_raw_binary_values(const DataTypePtr& data_type,
78
                                          int column_id) const override;
79
    Status execute_on_raw_binary_values(const StringRef* values, size_t num_values,
80
                                        const DataTypePtr& data_type, int column_id,
81
                                        uint8_t* matches) const override;
82
83
1.42k
    uint64_t get_digest(uint64_t seed) const override { return 0; }
84
7
    Status clone_node(VExprSPtr* cloned_expr) const override {
85
7
        DORIS_CHECK(cloned_expr != nullptr);
86
7
        auto node = clone_texpr_node();
87
7
        TInPredicate in_predicate;
88
7
        in_predicate.__set_is_not_in(_is_not_in);
89
7
        node.__set_in_predicate(in_predicate);
90
7
        *cloned_expr = VInPredicate::create_shared(node);
91
7
        return Status::OK();
92
7
    }
93
94
private:
95
    void _prepare_zonemap_min_max(VExprContext* context);
96
97
    FunctionBasePtr _function;
98
    std::string _expr_name;
99
100
    MOCK_REMOVE(const) bool _is_not_in;
101
    static const constexpr char* function_name = "in";
102
    uint32_t _in_list_value_count_threshold = 10;
103
    bool _is_args_all_constant = false;
104
    std::shared_ptr<HybridSetBase> _direct_filter_set;
105
    std::shared_ptr<const HybridSetMinMax> _zonemap_min_max;
106
};
107
} // namespace doris