Coverage Report

Created: 2026-10-15 05:06

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/aggregate/aggregate_function_map_v2.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 <glog/logging.h>
21
#include <parallel_hashmap/phmap.h>
22
23
#include <string>
24
25
#include "common/check.h"
26
#include "core/assert_cast.h"
27
#include "core/column/column_decimal.h"
28
#include "core/column/column_map.h"
29
#include "core/column/column_string.h"
30
#include "core/data_type/data_type_map.h"
31
#include "core/field.h"
32
#include "core/pod_array.h"
33
#include "exprs/aggregate/aggregate_function.h"
34
#include "exprs/aggregate/aggregate_function_simple_factory.h"
35
36
namespace doris {
37
38
template <bool use_exact_key_frame>
39
struct AggregateFunctionMapAggDataV2 {
40
    using Map = doris::flat_hash_map<Field, int64_t>;
41
42
0
    AggregateFunctionMapAggDataV2() {
43
0
        throw Exception(Status::FatalError("__builtin_unreachable"));
44
0
    }
Unexecuted instantiation: _ZN5doris29AggregateFunctionMapAggDataV2ILb1EEC2Ev
Unexecuted instantiation: _ZN5doris29AggregateFunctionMapAggDataV2ILb0EEC2Ev
45
46
    AggregateFunctionMapAggDataV2(const DataTypes& argument_types, const int be_exec_version)
47
106
            : _be_version(be_exec_version) {
48
106
        _key_type = make_nullable(argument_types[0]);
49
106
        _value_type = make_nullable(argument_types[1]);
50
106
        _key_column = _key_type->create_column();
51
106
        _value_column = _value_type->create_column();
52
106
    }
_ZN5doris29AggregateFunctionMapAggDataV2ILb1EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS6_EEi
Line
Count
Source
47
96
            : _be_version(be_exec_version) {
48
96
        _key_type = make_nullable(argument_types[0]);
49
96
        _value_type = make_nullable(argument_types[1]);
50
96
        _key_column = _key_type->create_column();
51
96
        _value_column = _value_type->create_column();
52
96
    }
_ZN5doris29AggregateFunctionMapAggDataV2ILb0EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS6_EEi
Line
Count
Source
47
10
            : _be_version(be_exec_version) {
48
10
        _key_type = make_nullable(argument_types[0]);
49
10
        _value_type = make_nullable(argument_types[1]);
50
10
        _key_column = _key_type->create_column();
51
10
        _value_column = _value_type->create_column();
52
10
    }
53
54
2
    void reset() {
55
2
        _map.clear();
56
2
        _key_column->clear();
57
2
        _value_column->clear();
58
2
    }
_ZN5doris29AggregateFunctionMapAggDataV2ILb1EE5resetEv
Line
Count
Source
54
2
    void reset() {
55
2
        _map.clear();
56
2
        _key_column->clear();
57
2
        _value_column->clear();
58
2
    }
Unexecuted instantiation: _ZN5doris29AggregateFunctionMapAggDataV2ILb0EE5resetEv
59
60
347
    void add_single(const Field& key, const Field& value) {
61
347
        if (UNLIKELY(_map.find(key) != _map.end())) {
62
2
            return;
63
2
        }
64
65
345
        _map.emplace(key, _key_column->size());
66
345
        _key_column->insert(key);
67
345
        _value_column->insert(value);
68
345
    }
_ZN5doris29AggregateFunctionMapAggDataV2ILb1EE10add_singleERKNS_5FieldES4_
Line
Count
Source
60
150
    void add_single(const Field& key, const Field& value) {
61
150
        if (UNLIKELY(_map.find(key) != _map.end())) {
62
2
            return;
63
2
        }
64
65
148
        _map.emplace(key, _key_column->size());
66
148
        _key_column->insert(key);
67
148
        _value_column->insert(value);
68
148
    }
_ZN5doris29AggregateFunctionMapAggDataV2ILb0EE10add_singleERKNS_5FieldES4_
Line
Count
Source
60
197
    void add_single(const Field& key, const Field& value) {
61
197
        if (UNLIKELY(_map.find(key) != _map.end())) {
62
0
            return;
63
0
        }
64
65
197
        _map.emplace(key, _key_column->size());
66
197
        _key_column->insert(key);
67
197
        _value_column->insert(value);
68
197
    }
69
70
344
    void add(const Field& key_, const Field& value) {
71
344
        DCHECK(!key_.is_null());
72
344
        auto key_array = key_.get<TYPE_ARRAY>();
73
344
        auto value_array = value.get<TYPE_ARRAY>();
74
75
344
        const auto count = key_array.size();
76
344
        DCHECK_EQ(count, value_array.size());
77
78
776
        for (size_t i = 0; i != count; ++i) {
79
432
            const auto& key = key_array[i];
80
81
432
            if (UNLIKELY(_map.find(key) != _map.end())) {
82
160
                continue;
83
160
            }
84
85
272
            _map.emplace(key, _key_column->size());
86
272
            _key_column->insert(key);
87
272
            _value_column->insert(value_array[i]);
88
272
        }
89
344
    }
_ZN5doris29AggregateFunctionMapAggDataV2ILb1EE3addERKNS_5FieldES4_
Line
Count
Source
70
344
    void add(const Field& key_, const Field& value) {
71
344
        DCHECK(!key_.is_null());
72
344
        auto key_array = key_.get<TYPE_ARRAY>();
73
344
        auto value_array = value.get<TYPE_ARRAY>();
74
75
344
        const auto count = key_array.size();
76
344
        DCHECK_EQ(count, value_array.size());
77
78
776
        for (size_t i = 0; i != count; ++i) {
79
432
            const auto& key = key_array[i];
80
81
432
            if (UNLIKELY(_map.find(key) != _map.end())) {
82
160
                continue;
83
160
            }
84
85
272
            _map.emplace(key, _key_column->size());
86
272
            _key_column->insert(key);
87
272
            _value_column->insert(value_array[i]);
88
272
        }
89
344
    }
Unexecuted instantiation: _ZN5doris29AggregateFunctionMapAggDataV2ILb0EE3addERKNS_5FieldES4_
90
91
3
    void merge(const AggregateFunctionMapAggDataV2& other) {
92
3
        const size_t num_rows = other._key_column->size();
93
3
        if (num_rows == 0) {
94
0
            return;
95
0
        }
96
97
3
        auto& other_key_column_nullable = assert_cast<ColumnNullable&>(*other._key_column);
98
87
        for (size_t i = 0; i != num_rows; ++i) {
99
84
            const auto& key = other_key_column_nullable[i];
100
84
            if (_map.find(key) != _map.cend()) {
101
0
                continue;
102
0
            }
103
104
84
            _map.emplace(key, _key_column->size());
105
84
            _key_column->insert(key);
106
107
84
            _value_column->insert((*other._value_column)[i]);
108
84
        }
109
3
    }
_ZN5doris29AggregateFunctionMapAggDataV2ILb1EE5mergeERKS1_
Line
Count
Source
91
3
    void merge(const AggregateFunctionMapAggDataV2& other) {
92
3
        const size_t num_rows = other._key_column->size();
93
3
        if (num_rows == 0) {
94
0
            return;
95
0
        }
96
97
3
        auto& other_key_column_nullable = assert_cast<ColumnNullable&>(*other._key_column);
98
87
        for (size_t i = 0; i != num_rows; ++i) {
99
84
            const auto& key = other_key_column_nullable[i];
100
84
            if (_map.find(key) != _map.cend()) {
101
0
                continue;
102
0
            }
103
104
84
            _map.emplace(key, _key_column->size());
105
84
            _key_column->insert(key);
106
107
84
            _value_column->insert((*other._value_column)[i]);
108
84
        }
109
3
    }
Unexecuted instantiation: _ZN5doris29AggregateFunctionMapAggDataV2ILb0EE5mergeERKS1_
110
111
238
    void insert_result_into(IColumn& to) const {
112
238
        auto& dst = assert_cast<ColumnMap&, TypeCheckOnRelease::DISABLE>(to);
113
238
        size_t num_rows = _key_column->size();
114
238
        auto& offsets = dst.get_offsets();
115
238
        auto& dst_key_column =
116
238
                assert_cast<ColumnNullable&, TypeCheckOnRelease::DISABLE>(dst.get_keys());
117
238
        dst_key_column.insert_range_from(*_key_column, 0, num_rows);
118
238
        dst.get_values().insert_range_from(*_value_column, 0, num_rows);
119
238
        if (offsets.empty()) {
120
92
            offsets.push_back(num_rows);
121
146
        } else {
122
146
            offsets.push_back(offsets.back() + num_rows);
123
146
        }
124
238
    }
_ZNK5doris29AggregateFunctionMapAggDataV2ILb1EE18insert_result_intoERNS_7IColumnE
Line
Count
Source
111
233
    void insert_result_into(IColumn& to) const {
112
233
        auto& dst = assert_cast<ColumnMap&, TypeCheckOnRelease::DISABLE>(to);
113
233
        size_t num_rows = _key_column->size();
114
233
        auto& offsets = dst.get_offsets();
115
233
        auto& dst_key_column =
116
233
                assert_cast<ColumnNullable&, TypeCheckOnRelease::DISABLE>(dst.get_keys());
117
233
        dst_key_column.insert_range_from(*_key_column, 0, num_rows);
118
233
        dst.get_values().insert_range_from(*_value_column, 0, num_rows);
119
233
        if (offsets.empty()) {
120
87
            offsets.push_back(num_rows);
121
146
        } else {
122
146
            offsets.push_back(offsets.back() + num_rows);
123
146
        }
124
233
    }
_ZNK5doris29AggregateFunctionMapAggDataV2ILb0EE18insert_result_intoERNS_7IColumnE
Line
Count
Source
111
5
    void insert_result_into(IColumn& to) const {
112
5
        auto& dst = assert_cast<ColumnMap&, TypeCheckOnRelease::DISABLE>(to);
113
5
        size_t num_rows = _key_column->size();
114
5
        auto& offsets = dst.get_offsets();
115
5
        auto& dst_key_column =
116
5
                assert_cast<ColumnNullable&, TypeCheckOnRelease::DISABLE>(dst.get_keys());
117
5
        dst_key_column.insert_range_from(*_key_column, 0, num_rows);
118
5
        dst.get_values().insert_range_from(*_value_column, 0, num_rows);
119
5
        if (offsets.empty()) {
120
5
            offsets.push_back(num_rows);
121
5
        } else {
122
0
            offsets.push_back(offsets.back() + num_rows);
123
0
        }
124
5
    }
125
126
12
    void write(BufferWritable& buf) const {
127
12
        std::string serialized_buffer;
128
12
        write_column(*_key_type, *_key_column, buf, serialized_buffer, use_exact_key_frame);
129
12
        write_column(*_value_type, *_value_column, buf, serialized_buffer, true);
130
12
    }
_ZNK5doris29AggregateFunctionMapAggDataV2ILb1EE5writeERNS_14BufferWritableE
Line
Count
Source
126
7
    void write(BufferWritable& buf) const {
127
7
        std::string serialized_buffer;
128
7
        write_column(*_key_type, *_key_column, buf, serialized_buffer, use_exact_key_frame);
129
7
        write_column(*_value_type, *_value_column, buf, serialized_buffer, true);
130
7
    }
_ZNK5doris29AggregateFunctionMapAggDataV2ILb0EE5writeERNS_14BufferWritableE
Line
Count
Source
126
5
    void write(BufferWritable& buf) const {
127
5
        std::string serialized_buffer;
128
5
        write_column(*_key_type, *_key_column, buf, serialized_buffer, use_exact_key_frame);
129
5
        write_column(*_value_type, *_value_column, buf, serialized_buffer, true);
130
5
    }
131
132
12
    void read(BufferReadable& buf) {
133
12
        PaddedPODArray<UInt8> frame;
134
12
        read_column(*_key_type, &_key_column, buf, frame, use_exact_key_frame);
135
12
        read_column(*_value_type, &_value_column, buf, frame, true);
136
12
    }
_ZN5doris29AggregateFunctionMapAggDataV2ILb1EE4readERNS_14BufferReadableE
Line
Count
Source
132
7
    void read(BufferReadable& buf) {
133
7
        PaddedPODArray<UInt8> frame;
134
7
        read_column(*_key_type, &_key_column, buf, frame, use_exact_key_frame);
135
7
        read_column(*_value_type, &_value_column, buf, frame, true);
136
7
    }
_ZN5doris29AggregateFunctionMapAggDataV2ILb0EE4readERNS_14BufferReadableE
Line
Count
Source
132
5
    void read(BufferReadable& buf) {
133
5
        PaddedPODArray<UInt8> frame;
134
5
        read_column(*_key_type, &_key_column, buf, frame, use_exact_key_frame);
135
5
        read_column(*_value_type, &_value_column, buf, frame, true);
136
5
    }
137
138
private:
139
    void write_column(const IDataType& type, const IColumn& column, BufferWritable& buf,
140
24
                      std::string& serialized_buffer, bool use_exact_frame) const {
141
24
        const auto max_serialized_bytes =
142
24
                type.get_uncompressed_serialized_bytes(column, _be_version);
143
24
        serialized_buffer.resize(max_serialized_bytes, '\0');
144
145
24
        const auto* end = type.serialize(column, serialized_buffer.data(), _be_version);
146
24
        const auto written_bytes = end - serialized_buffer.data();
147
24
        DORIS_CHECK_LE(written_bytes, max_serialized_bytes);
148
149
24
        if (use_exact_frame) {
150
19
            serialized_buffer.resize(written_bytes);
151
19
        }
152
24
        buf.write_binary(serialized_buffer);
153
24
    }
_ZNK5doris29AggregateFunctionMapAggDataV2ILb1EE12write_columnERKNS_9IDataTypeERKNS_7IColumnERNS_14BufferWritableERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb
Line
Count
Source
140
14
                      std::string& serialized_buffer, bool use_exact_frame) const {
141
14
        const auto max_serialized_bytes =
142
14
                type.get_uncompressed_serialized_bytes(column, _be_version);
143
14
        serialized_buffer.resize(max_serialized_bytes, '\0');
144
145
14
        const auto* end = type.serialize(column, serialized_buffer.data(), _be_version);
146
14
        const auto written_bytes = end - serialized_buffer.data();
147
14
        DORIS_CHECK_LE(written_bytes, max_serialized_bytes);
148
149
14
        if (use_exact_frame) {
150
14
            serialized_buffer.resize(written_bytes);
151
14
        }
152
14
        buf.write_binary(serialized_buffer);
153
14
    }
_ZNK5doris29AggregateFunctionMapAggDataV2ILb0EE12write_columnERKNS_9IDataTypeERKNS_7IColumnERNS_14BufferWritableERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb
Line
Count
Source
140
10
                      std::string& serialized_buffer, bool use_exact_frame) const {
141
10
        const auto max_serialized_bytes =
142
10
                type.get_uncompressed_serialized_bytes(column, _be_version);
143
10
        serialized_buffer.resize(max_serialized_bytes, '\0');
144
145
10
        const auto* end = type.serialize(column, serialized_buffer.data(), _be_version);
146
10
        const auto written_bytes = end - serialized_buffer.data();
147
10
        DORIS_CHECK_LE(written_bytes, max_serialized_bytes);
148
149
10
        if (use_exact_frame) {
150
5
            serialized_buffer.resize(written_bytes);
151
5
        }
152
10
        buf.write_binary(serialized_buffer);
153
10
    }
154
155
    void read_column(const IDataType& type, MutableColumnPtr* column, BufferReadable& buf,
156
24
                     PaddedPODArray<UInt8>& frame, bool use_exact_frame) const {
157
24
        buf.read_binary(frame);
158
159
24
        const auto* begin = reinterpret_cast<const char*>(frame.data());
160
24
        const auto* frame_end = begin + frame.size();
161
24
        const auto* end = type.deserialize(begin, column, _be_version);
162
24
        if (use_exact_frame) {
163
19
            DORIS_CHECK_EQ(end, frame_end);
164
19
            return;
165
19
        }
166
167
5
        DORIS_CHECK_LE(end, frame_end);
168
5
        const auto expected_frame_size =
169
5
                type.get_uncompressed_serialized_bytes(**column, _be_version);
170
5
        DORIS_CHECK_EQ(frame.size(), expected_frame_size);
171
5
    }
_ZNK5doris29AggregateFunctionMapAggDataV2ILb1EE11read_columnERKNS_9IDataTypeEPNS_3COWINS_7IColumnEE11mutable_ptrIS6_EERNS_14BufferReadableERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEb
Line
Count
Source
156
14
                     PaddedPODArray<UInt8>& frame, bool use_exact_frame) const {
157
14
        buf.read_binary(frame);
158
159
14
        const auto* begin = reinterpret_cast<const char*>(frame.data());
160
14
        const auto* frame_end = begin + frame.size();
161
14
        const auto* end = type.deserialize(begin, column, _be_version);
162
14
        if (use_exact_frame) {
163
14
            DORIS_CHECK_EQ(end, frame_end);
164
14
            return;
165
14
        }
166
167
0
        DORIS_CHECK_LE(end, frame_end);
168
0
        const auto expected_frame_size =
169
0
                type.get_uncompressed_serialized_bytes(**column, _be_version);
170
        DORIS_CHECK_EQ(frame.size(), expected_frame_size);
171
0
    }
_ZNK5doris29AggregateFunctionMapAggDataV2ILb0EE11read_columnERKNS_9IDataTypeEPNS_3COWINS_7IColumnEE11mutable_ptrIS6_EERNS_14BufferReadableERNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEb
Line
Count
Source
156
10
                     PaddedPODArray<UInt8>& frame, bool use_exact_frame) const {
157
10
        buf.read_binary(frame);
158
159
10
        const auto* begin = reinterpret_cast<const char*>(frame.data());
160
10
        const auto* frame_end = begin + frame.size();
161
10
        const auto* end = type.deserialize(begin, column, _be_version);
162
10
        if (use_exact_frame) {
163
5
            DORIS_CHECK_EQ(end, frame_end);
164
5
            return;
165
5
        }
166
167
5
        DORIS_CHECK_LE(end, frame_end);
168
5
        const auto expected_frame_size =
169
5
                type.get_uncompressed_serialized_bytes(**column, _be_version);
170
        DORIS_CHECK_EQ(frame.size(), expected_frame_size);
171
5
    }
172
173
    Map _map;
174
    Arena _arena;
175
    IColumn::MutablePtr _key_column;
176
    IColumn::MutablePtr _value_column;
177
    DataTypePtr _key_type;
178
    DataTypePtr _value_type;
179
180
    int _be_version;
181
};
182
183
template <typename Data>
184
class AggregateFunctionMapAggV2 final
185
        : public IAggregateFunctionDataHelper<Data, AggregateFunctionMapAggV2<Data>>,
186
          MultiExpression,
187
          NotNullableAggregateFunction {
188
public:
189
    AggregateFunctionMapAggV2() = default;
190
    AggregateFunctionMapAggV2(const DataTypes& argument_types_)
191
93
            : IAggregateFunctionDataHelper<Data, AggregateFunctionMapAggV2<Data>>(argument_types_) {
192
93
    }
_ZN5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS8_EE
Line
Count
Source
191
10
            : IAggregateFunctionDataHelper<Data, AggregateFunctionMapAggV2<Data>>(argument_types_) {
192
10
    }
_ZN5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS8_EE
Line
Count
Source
191
83
            : IAggregateFunctionDataHelper<Data, AggregateFunctionMapAggV2<Data>>(argument_types_) {
192
83
    }
193
194
    using IAggregateFunctionDataHelper<Data, AggregateFunctionMapAggV2<Data>>::version;
195
196
1
    std::string get_name() const override { return "map_agg_v2"; }
Unexecuted instantiation: _ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE8get_nameB5cxx11Ev
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE8get_nameB5cxx11Ev
Line
Count
Source
196
1
    std::string get_name() const override { return "map_agg_v2"; }
197
198
195
    DataTypePtr get_return_type() const override {
199
        /// keys and values column of `ColumnMap` are always nullable.
200
195
        return std::make_shared<DataTypeMap>(make_nullable(argument_types[0]),
201
195
                                             make_nullable(argument_types[1]));
202
195
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE15get_return_typeEv
Line
Count
Source
198
96
    DataTypePtr get_return_type() const override {
199
        /// keys and values column of `ColumnMap` are always nullable.
200
96
        return std::make_shared<DataTypeMap>(make_nullable(argument_types[0]),
201
96
                                             make_nullable(argument_types[1]));
202
96
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE15get_return_typeEv
Line
Count
Source
198
99
    DataTypePtr get_return_type() const override {
199
        /// keys and values column of `ColumnMap` are always nullable.
200
99
        return std::make_shared<DataTypeMap>(make_nullable(argument_types[0]),
201
99
                                             make_nullable(argument_types[1]));
202
99
    }
203
204
    void add(AggregateDataPtr __restrict place, const IColumn** columns, ssize_t row_num,
205
148
             Arena&) const override {
206
148
        Field key, value;
207
148
        columns[0]->get(row_num, key);
208
148
        columns[1]->get(row_num, value);
209
148
        this->data(place).add_single(key, value);
210
148
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
205
83
             Arena&) const override {
206
83
        Field key, value;
207
83
        columns[0]->get(row_num, key);
208
83
        columns[1]->get(row_num, value);
209
83
        this->data(place).add_single(key, value);
210
83
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
205
65
             Arena&) const override {
206
65
        Field key, value;
207
65
        columns[0]->get(row_num, key);
208
65
        columns[1]->get(row_num, value);
209
65
        this->data(place).add_single(key, value);
210
65
    }
211
212
93
    void create(AggregateDataPtr __restrict place) const override {
213
93
        new (place) Data(argument_types, version);
214
93
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE6createEPc
Line
Count
Source
212
90
    void create(AggregateDataPtr __restrict place) const override {
213
90
        new (place) Data(argument_types, version);
214
90
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE6createEPc
Line
Count
Source
212
3
    void create(AggregateDataPtr __restrict place) const override {
213
3
        new (place) Data(argument_types, version);
214
3
    }
215
216
2
    void reset(AggregateDataPtr place) const override { this->data(place).reset(); }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE5resetEPc
Line
Count
Source
216
2
    void reset(AggregateDataPtr place) const override { this->data(place).reset(); }
Unexecuted instantiation: _ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE5resetEPc
217
218
    void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs,
219
3
               Arena&) const override {
220
3
        this->data(place).merge(this->data(rhs));
221
3
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
219
3
               Arena&) const override {
220
3
        this->data(place).merge(this->data(rhs));
221
3
    }
Unexecuted instantiation: _ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE5mergeEPcPKcRNS_5ArenaE
222
223
5
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
224
5
        this->data(place).write(buf);
225
5
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
223
4
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
224
4
        this->data(place).write(buf);
225
4
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
223
1
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
224
1
        this->data(place).write(buf);
225
1
    }
226
227
    void deserialize(AggregateDataPtr __restrict place, BufferReadable& buf,
228
6
                     Arena&) const override {
229
6
        this->data(place).read(buf);
230
6
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
228
4
                     Arena&) const override {
229
4
        this->data(place).read(buf);
230
4
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
228
2
                     Arena&) const override {
229
2
        this->data(place).read(buf);
230
2
    }
231
232
    void streaming_agg_serialize_to_column(const IColumn** columns, MutableColumnPtr& dst,
233
2
                                           const size_t num_rows, Arena&) const override {
234
2
        auto& col = assert_cast<ColumnMap&>(*dst);
235
84
        for (size_t i = 0; i != num_rows; ++i) {
236
82
            Field key, value;
237
82
            columns[0]->get(i, key);
238
82
            columns[1]->get(i, value);
239
82
            col.insert(Field::create_field<TYPE_MAP>(
240
82
                    Map {Field::create_field<TYPE_ARRAY>(Array {key}),
241
82
                         Field::create_field<TYPE_ARRAY>(Array {value})}));
242
82
        }
243
2
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE33streaming_agg_serialize_to_columnEPPKNS_7IColumnERNS_3COWIS4_E11mutable_ptrIS4_EEmRNS_5ArenaE
Line
Count
Source
233
2
                                           const size_t num_rows, Arena&) const override {
234
2
        auto& col = assert_cast<ColumnMap&>(*dst);
235
84
        for (size_t i = 0; i != num_rows; ++i) {
236
82
            Field key, value;
237
82
            columns[0]->get(i, key);
238
82
            columns[1]->get(i, value);
239
82
            col.insert(Field::create_field<TYPE_MAP>(
240
82
                    Map {Field::create_field<TYPE_ARRAY>(Array {key}),
241
82
                         Field::create_field<TYPE_ARRAY>(Array {value})}));
242
82
        }
243
2
    }
Unexecuted instantiation: _ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE33streaming_agg_serialize_to_columnEPPKNS_7IColumnERNS_3COWIS4_E11mutable_ptrIS4_EEmRNS_5ArenaE
244
245
    void serialize_to_column(const std::vector<AggregateDataPtr>& places, size_t offset,
246
0
                             MutableColumnPtr& dst, const size_t num_rows) const override {
247
0
        for (size_t i = 0; i != num_rows; ++i) {
248
0
            Data& data_ = this->data(places[i] + offset);
249
0
            data_.insert_result_into(*dst);
250
0
        }
251
0
    }
Unexecuted instantiation: _ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE19serialize_to_columnERKSt6vectorIPcSaIS5_EEmRNS_3COWINS_7IColumnEE11mutable_ptrISB_EEm
Unexecuted instantiation: _ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE19serialize_to_columnERKSt6vectorIPcSaIS5_EEmRNS_3COWINS_7IColumnEE11mutable_ptrISB_EEm
252
253
    void deserialize_from_column_row(AggregateDataPtr __restrict place, const IColumn& column,
254
10
                                     size_t row, Arena&) const override {
255
10
        DCHECK_LT(row, column.size());
256
10
        const auto& col = assert_cast<const ColumnMap&>(column);
257
10
        auto map = col[row].get<TYPE_MAP>();
258
10
        this->data(place).add(map[0], map[1]);
259
10
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE27deserialize_from_column_rowEPcRKNS_7IColumnEmRNS_5ArenaE
Line
Count
Source
254
10
                                     size_t row, Arena&) const override {
255
        DCHECK_LT(row, column.size());
256
10
        const auto& col = assert_cast<const ColumnMap&>(column);
257
10
        auto map = col[row].get<TYPE_MAP>();
258
10
        this->data(place).add(map[0], map[1]);
259
10
    }
Unexecuted instantiation: _ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE27deserialize_from_column_rowEPcRKNS_7IColumnEmRNS_5ArenaE
260
261
    void deserialize_and_merge_from_column_range(AggregateDataPtr __restrict place,
262
                                                 const IColumn& column, size_t begin, size_t end,
263
134
                                                 Arena&) const override {
264
134
        DCHECK(end <= column.size() && begin <= end)
265
0
                << ", begin:" << begin << ", end:" << end << ", column.size():" << column.size();
266
134
        const auto& col = assert_cast<const ColumnMap&>(column);
267
348
        for (size_t i = begin; i <= end; ++i) {
268
214
            auto map = col[i].get<TYPE_MAP>();
269
214
            this->data(place).add(map[0], map[1]);
270
214
        }
271
134
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE39deserialize_and_merge_from_column_rangeEPcRKNS_7IColumnEmmRNS_5ArenaE
Line
Count
Source
263
134
                                                 Arena&) const override {
264
134
        DCHECK(end <= column.size() && begin <= end)
265
0
                << ", begin:" << begin << ", end:" << end << ", column.size():" << column.size();
266
134
        const auto& col = assert_cast<const ColumnMap&>(column);
267
348
        for (size_t i = begin; i <= end; ++i) {
268
214
            auto map = col[i].get<TYPE_MAP>();
269
214
            this->data(place).add(map[0], map[1]);
270
214
        }
271
134
    }
Unexecuted instantiation: _ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE39deserialize_and_merge_from_column_rangeEPcRKNS_7IColumnEmmRNS_5ArenaE
272
273
69
    bool needs_deserialize_and_merge_scratch() const override { return false; }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE35needs_deserialize_and_merge_scratchEv
Line
Count
Source
273
69
    bool needs_deserialize_and_merge_scratch() const override { return false; }
Unexecuted instantiation: _ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE35needs_deserialize_and_merge_scratchEv
274
275
    void deserialize_and_merge_vec(const AggregateDataPtr* places, size_t offset,
276
                                   AggregateDataPtr rhs, const IColumn* column, Arena&,
277
12
                                   const size_t num_rows) const override {
278
12
        const auto& col = assert_cast<const ColumnMap&>(*column);
279
84
        for (size_t i = 0; i != num_rows; ++i) {
280
72
            auto map = col[i].get<TYPE_MAP>();
281
72
            this->data(places[i] + offset).add(map[0], map[1]);
282
72
        }
283
12
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE25deserialize_and_merge_vecEPKPcmS4_PKNS_7IColumnERNS_5ArenaEm
Line
Count
Source
277
12
                                   const size_t num_rows) const override {
278
12
        const auto& col = assert_cast<const ColumnMap&>(*column);
279
84
        for (size_t i = 0; i != num_rows; ++i) {
280
72
            auto map = col[i].get<TYPE_MAP>();
281
72
            this->data(places[i] + offset).add(map[0], map[1]);
282
72
        }
283
12
    }
Unexecuted instantiation: _ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE25deserialize_and_merge_vecEPKPcmS4_PKNS_7IColumnERNS_5ArenaEm
284
285
    void deserialize_and_merge_vec_selected(const AggregateDataPtr* places, size_t offset,
286
                                            AggregateDataPtr rhs, const IColumn* column, Arena&,
287
20
                                            const size_t num_rows) const override {
288
20
        const auto& col = assert_cast<const ColumnMap&>(*column);
289
140
        for (size_t i = 0; i != num_rows; ++i) {
290
120
            if (places[i]) {
291
48
                auto map = col[i].get<TYPE_MAP>();
292
48
                this->data(places[i] + offset).add(map[0], map[1]);
293
48
            }
294
120
        }
295
20
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE34deserialize_and_merge_vec_selectedEPKPcmS4_PKNS_7IColumnERNS_5ArenaEm
Line
Count
Source
287
20
                                            const size_t num_rows) const override {
288
20
        const auto& col = assert_cast<const ColumnMap&>(*column);
289
140
        for (size_t i = 0; i != num_rows; ++i) {
290
120
            if (places[i]) {
291
48
                auto map = col[i].get<TYPE_MAP>();
292
48
                this->data(places[i] + offset).add(map[0], map[1]);
293
48
            }
294
120
        }
295
20
    }
Unexecuted instantiation: _ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE34deserialize_and_merge_vec_selectedEPKPcmS4_PKNS_7IColumnERNS_5ArenaEm
296
297
    void serialize_without_key_to_column(ConstAggregateDataPtr __restrict place,
298
12
                                         IColumn& to) const override {
299
12
        this->data(place).insert_result_into(to);
300
12
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE31serialize_without_key_to_columnEPKcRNS_7IColumnE
Line
Count
Source
298
12
                                         IColumn& to) const override {
299
12
        this->data(place).insert_result_into(to);
300
12
    }
Unexecuted instantiation: _ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE31serialize_without_key_to_columnEPKcRNS_7IColumnE
301
302
220
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
303
220
        this->data(place).insert_result_into(to);
304
220
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
302
218
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
303
218
        this->data(place).insert_result_into(to);
304
218
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
302
2
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
303
2
        this->data(place).insert_result_into(to);
304
2
    }
305
306
32
    [[nodiscard]] MutableColumnPtr create_serialize_column() const override {
307
32
        return get_return_type()->create_column();
308
32
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE23create_serialize_columnEv
Line
Count
Source
306
16
    [[nodiscard]] MutableColumnPtr create_serialize_column() const override {
307
16
        return get_return_type()->create_column();
308
16
    }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE23create_serialize_columnEv
Line
Count
Source
306
16
    [[nodiscard]] MutableColumnPtr create_serialize_column() const override {
307
16
        return get_return_type()->create_column();
308
16
    }
309
310
86
    [[nodiscard]] DataTypePtr get_serialized_type() const override { return get_return_type(); }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb1EEEE19get_serialized_typeEv
Line
Count
Source
310
5
    [[nodiscard]] DataTypePtr get_serialized_type() const override { return get_return_type(); }
_ZNK5doris25AggregateFunctionMapAggV2INS_29AggregateFunctionMapAggDataV2ILb0EEEE19get_serialized_typeEv
Line
Count
Source
310
81
    [[nodiscard]] DataTypePtr get_serialized_type() const override { return get_return_type(); }
311
312
protected:
313
    using IAggregateFunction::argument_types;
314
};
315
316
} // namespace doris