Coverage Report

Created: 2025-12-28 00:30

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/doris/be/src/vec/exprs/vliteral.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 "vec/data_types/data_type.h"
26
#include "vec/data_types/serde/data_type_serde.h"
27
#include "vec/exprs/vexpr.h"
28
29
namespace doris {
30
class TExprNode;
31
32
namespace vectorized {
33
class Block;
34
class VExprContext;
35
36
class VLiteral : public VExpr {
37
    ENABLE_FACTORY_CREATOR(VLiteral);
38
39
public:
40
    VLiteral(const TExprNode& node, bool should_init = true)
41
224
            : VExpr(node), _expr_name(_data_type->get_name()) {
42
224
        if (should_init) {
43
211
            init(node);
44
211
        }
45
224
    }
46
47
#ifdef BE_TEST
48
163
    VLiteral() = default;
49
    MOCK_FUNCTION std::string value() const;
50
#endif
51
52
    Status prepare(RuntimeState* state, const RowDescriptor& desc, VExprContext* context) override;
53
    Status execute_column(VExprContext* context, const Block* block, size_t count,
54
                          ColumnPtr& result_column) const override;
55
56
124
    const std::string& expr_name() const override { return _expr_name; }
57
    std::string debug_string() const override;
58
59
    MOCK_FUNCTION std::string value(const DataTypeSerDe::FormatOptions& options) const;
60
61
232
    const ColumnPtr& get_column_ptr() const { return _column_ptr; }
62
4
    const DataTypePtr& get_data_type() const { return _data_type; }
63
64
136
    bool is_literal() const override { return true; }
65
66
    bool equals(const VExpr& other) override;
67
68
    uint64_t get_digest(uint64_t seed) const override;
69
70
protected:
71
    ColumnPtr _column_ptr;
72
    std::string _expr_name;
73
74
private:
75
    void init(const TExprNode& node);
76
};
77
} // namespace vectorized
78
79
} // namespace doris