Coverage Report

Created: 2026-06-09 13:53

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/vslot_ref.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
#include <string>
20
21
#include "common/object_pool.h"
22
#include "common/status.h"
23
#include "exprs/vexpr.h"
24
25
namespace doris {
26
class SlotDescriptor;
27
class RowDescriptor;
28
class RuntimeState;
29
class TExprNode;
30
31
class Block;
32
class VExprContext;
33
34
class VSlotRef : public VExpr {
35
    ENABLE_FACTORY_CREATOR(VSlotRef);
36
37
public:
38
    VSlotRef(const TExprNode& node);
39
    VSlotRef(const SlotDescriptor* desc);
40
#ifdef BE_TEST
41
573
    VSlotRef() = default;
42
6
    void set_slot_id(int slot_id) { _slot_id = slot_id; }
43
#endif
44
6
    void set_column_id(int column_id) { _column_id = column_id; }
45
    Status prepare(RuntimeState* state, const RowDescriptor& desc, VExprContext* context) override;
46
    Status open(RuntimeState* state, VExprContext* context,
47
                FunctionContext::FunctionStateScope scope) override;
48
    Status execute(VExprContext* context, Block* block, int* result_column_id) const override;
49
    Status execute_column_impl(VExprContext* context, const Block* block, const Selector* selector,
50
                               size_t count, ColumnPtr& result_column) const override;
51
    DataTypePtr execute_type(const Block* block) const override;
52
53
    const std::string& expr_name() const override;
54
    std::string expr_label() override;
55
    std::string debug_string() const override;
56
258k
    bool is_constant() const override { return false; }
57
58
4.14k
    int column_id() const { return _column_id; }
59
60
317
    MOCK_FUNCTION int slot_id() const { return _slot_id; }
61
0
    int column_uniq_id() const { return _column_uniq_id; }
62
63
    bool equals(const VExpr& other) override;
64
65
0
    size_t estimate_memory(const size_t rows) override { return 0; }
66
67
16
    void collect_slot_column_ids(std::set<int>& column_ids) const override {
68
16
        column_ids.insert(_column_id);
69
16
    }
70
71
0
    virtual const std::string& column_name() const { return *_column_name; }
72
73
    uint64_t get_digest(uint64_t seed) const override;
74
75
16
    double execute_cost() const override { return 0.0; }
76
77
protected:
78
    VSlotRef(int slot_id, int column_id, int column_uniq_id)
79
0
            : _slot_id(slot_id), _column_id(column_id), _column_uniq_id(column_uniq_id) {
80
0
        _node_type = TExprNodeType::SLOT_REF;
81
0
    }
82
83
private:
84
    int _slot_id;
85
    int _column_id;
86
    int _column_uniq_id = -1;
87
    const std::string* _column_name = nullptr;
88
    const std::string _column_label;
89
};
90
} // namespace doris