Coverage Report

Created: 2026-04-01 22:53

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/vlambda_function_expr.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 "common/global_types.h"
20
#include "exprs/function/function.h"
21
#include "exprs/vexpr.h"
22
23
namespace doris {
24
class VLambdaFunctionExpr final : public VExpr {
25
    ENABLE_FACTORY_CREATOR(VLambdaFunctionExpr);
26
27
public:
28
0
    VLambdaFunctionExpr(const TExprNode& node) : VExpr(node) {}
29
0
    ~VLambdaFunctionExpr() override = default;
30
31
0
    Status prepare(RuntimeState* state, const RowDescriptor& desc, VExprContext* context) override {
32
0
        RETURN_IF_ERROR_OR_PREPARED(VExpr::prepare(state, desc, context));
33
        // Fix _data_type to match the lambda body's actual return type.
34
        // The initial _data_type was set to DataTypeString as a placeholder during
35
        // VExpr(TExprNode) construction; override it with the body's real type.
36
0
        data_type() = get_child(0)->data_type();
37
0
        _prepare_finished = true;
38
0
        return Status::OK();
39
0
    }
40
41
    Status open(RuntimeState* state, VExprContext* context,
42
0
                FunctionContext::FunctionStateScope scope) override {
43
0
        DCHECK(_prepare_finished);
44
0
        RETURN_IF_ERROR(VExpr::open(state, context, scope));
45
0
        _open_finished = true;
46
0
        return Status::OK();
47
0
    }
48
49
    Status execute_column(VExprContext* context, const Block* block, Selector* selector,
50
0
                          size_t count, ColumnPtr& result_column) const override {
51
0
        DCHECK(_open_finished || block == nullptr);
52
0
        return get_child(0)->execute_column(context, block, selector, count, result_column);
53
0
    }
54
55
0
    DataTypePtr execute_type(const Block* block) const override {
56
0
        return get_child(0)->execute_type(block);
57
0
    }
58
59
0
    const std::string& expr_name() const override { return _expr_name; }
60
61
0
    uint64_t get_digest(uint64_t seed) const override { return 0; }
62
63
private:
64
    const std::string _expr_name = "vlambda_function_expr";
65
};
66
} // namespace doris