Coverage Report

Created: 2026-04-17 23:17

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/aggregate/aggregate_function_state_merge.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 "exprs/aggregate/aggregate_function_state_union.h"
21
22
namespace doris {
23
const static std::string AGG_MERGE_SUFFIX = "_merge";
24
25
class AggregateStateMerge : public AggregateStateUnion {
26
public:
27
    using AggregateStateUnion::create;
28
29
    AggregateStateMerge(AggregateFunctionPtr function, const DataTypes& argument_types_,
30
                        const DataTypePtr& return_type)
31
0
            : AggregateStateUnion(function, argument_types_, return_type) {}
32
33
    static AggregateFunctionPtr create(AggregateFunctionPtr function,
34
                                       const DataTypes& argument_types_,
35
0
                                       const DataTypePtr& return_type) {
36
0
        CHECK(argument_types_.size() == 1);
37
0
        if (function == nullptr) {
38
0
            return nullptr;
39
0
        }
40
0
        return std::make_shared<AggregateStateMerge>(function, argument_types_, return_type);
41
0
    }
42
43
0
    void set_version(const int version_) override {
44
0
        IAggregateFunctionHelper::set_version(version_);
45
0
        _function->set_version(version_);
46
0
    }
47
48
0
    String get_name() const override { return _function->get_name() + AGG_MERGE_SUFFIX; }
49
50
0
    DataTypePtr get_return_type() const override { return _function->get_return_type(); }
51
52
0
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
53
0
        _function->insert_result_into(place, to);
54
0
    }
55
};
56
57
} // namespace doris