Coverage Report

Created: 2026-04-15 09:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/aggregate/aggregate_function_percentile.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 <stddef.h>
22
#include <stdint.h>
23
24
#include <algorithm>
25
#include <boost/iterator/iterator_facade.hpp>
26
#include <cmath>
27
#include <cstdint>
28
#include <cstring>
29
#include <memory>
30
#include <string>
31
#include <vector>
32
33
#include "core/assert_cast.h"
34
#include "core/column/column.h"
35
#include "core/column/column_array.h"
36
#include "core/column/column_const.h"
37
#include "core/column/column_nullable.h"
38
#include "core/column/column_vector.h"
39
#include "core/data_type/data_type_array.h"
40
#include "core/data_type/data_type_nullable.h"
41
#include "core/data_type/data_type_number.h"
42
#include "core/pod_array.h"
43
#include "core/pod_array_fwd.h"
44
#include "core/types.h"
45
#include "exprs/aggregate/aggregate_function.h"
46
#include "util/percentile_levels.h"
47
#include "util/tdigest.h"
48
49
namespace doris {
50
51
class Arena;
52
class BufferReadable;
53
54
struct PercentileApproxState {
55
    static constexpr double INIT_QUANTILE = -1.0;
56
1.05k
    PercentileApproxState() = default;
57
1.05k
    ~PercentileApproxState() = default;
58
59
874
    void init(double quantile, float compression = 10000) {
60
874
        if (!init_flag) {
61
            //https://doris.apache.org/zh-CN/sql-reference/sql-functions/aggregate-functions/percentile_approx.html#description
62
            //The compression parameter setting range is [2048, 10000].
63
            //If the value of compression parameter is not specified set, or is outside the range of [2048, 10000],
64
            //will use the default value of 10000
65
464
            if (compression < 2048 || compression > 10000) {
66
0
                compression = 10000;
67
0
            }
68
464
            digest = TDigest::create_unique(compression);
69
464
            check_quantile(quantile);
70
464
            target_quantile = quantile;
71
464
            compressions = compression;
72
464
            init_flag = true;
73
464
        }
74
874
    }
75
76
352
    void write(BufferWritable& buf) const {
77
352
        buf.write_binary(init_flag);
78
352
        if (!init_flag) {
79
0
            return;
80
0
        }
81
82
352
        buf.write_binary(target_quantile);
83
352
        buf.write_binary(compressions);
84
352
        uint32_t serialize_size = digest->serialized_size();
85
352
        std::string result(serialize_size, '0');
86
352
        DCHECK(digest.get() != nullptr);
87
352
        digest->serialize((uint8_t*)result.c_str());
88
89
352
        buf.write_binary(result);
90
352
    }
91
92
313
    void read(BufferReadable& buf) {
93
313
        buf.read_binary(init_flag);
94
313
        if (!init_flag) {
95
0
            return;
96
0
        }
97
98
313
        buf.read_binary(target_quantile);
99
313
        buf.read_binary(compressions);
100
313
        std::string str;
101
313
        buf.read_binary(str);
102
313
        digest = TDigest::create_unique(compressions);
103
313
        digest->unserialize((uint8_t*)str.c_str());
104
313
    }
105
106
364
    double get() const {
107
364
        if (init_flag) {
108
362
            return digest->quantile(static_cast<float>(target_quantile));
109
362
        } else {
110
2
            return std::nan("");
111
2
        }
112
364
    }
113
114
314
    void merge(const PercentileApproxState& rhs) {
115
314
        if (!rhs.init_flag) {
116
0
            return;
117
0
        }
118
314
        if (init_flag) {
119
165
            DCHECK(digest.get() != nullptr);
120
165
            digest->merge(rhs.digest.get());
121
165
        } else {
122
149
            digest = TDigest::create_unique(compressions);
123
149
            digest->merge(rhs.digest.get());
124
149
            init_flag = true;
125
149
        }
126
314
        if (target_quantile == PercentileApproxState::INIT_QUANTILE) {
127
148
            target_quantile = rhs.target_quantile;
128
148
        }
129
314
    }
130
131
737
    void add(double source) { digest->add(static_cast<float>(source)); }
132
133
134
    void add_with_weight(double source, double weight) {
134
        // the weight should be positive num, as have check the value valid use DCHECK_GT(c._weight, 0);
135
134
        if (weight <= 0) {
136
10
            return;
137
10
        }
138
124
        digest->add(static_cast<float>(source), static_cast<float>(weight));
139
124
    }
140
141
154
    void reset() {
142
154
        target_quantile = INIT_QUANTILE;
143
154
        init_flag = false;
144
154
        digest = TDigest::create_unique(compressions);
145
154
    }
146
147
    bool init_flag = false;
148
    std::unique_ptr<TDigest> digest;
149
    double target_quantile = INIT_QUANTILE;
150
    float compressions = 10000;
151
};
152
153
class AggregateFunctionPercentileApprox
154
        : public IAggregateFunctionDataHelper<PercentileApproxState,
155
                                              AggregateFunctionPercentileApprox> {
156
public:
157
    AggregateFunctionPercentileApprox(const DataTypes& argument_types_)
158
708
            : IAggregateFunctionDataHelper<PercentileApproxState,
159
708
                                           AggregateFunctionPercentileApprox>(argument_types_) {}
160
161
178
    String get_name() const override { return "percentile_approx"; }
162
163
154
    void reset(AggregateDataPtr __restrict place) const override {
164
154
        AggregateFunctionPercentileApprox::data(place).reset();
165
154
    }
166
167
    void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs,
168
314
               Arena&) const override {
169
314
        AggregateFunctionPercentileApprox::data(place).merge(
170
314
                AggregateFunctionPercentileApprox::data(rhs));
171
314
    }
172
173
352
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
174
352
        AggregateFunctionPercentileApprox::data(place).write(buf);
175
352
    }
176
177
    void deserialize(AggregateDataPtr __restrict place, BufferReadable& buf,
178
314
                     Arena&) const override {
179
314
        AggregateFunctionPercentileApprox::data(place).read(buf);
180
314
    }
181
};
182
183
class AggregateFunctionPercentileApproxTwoParams final : public AggregateFunctionPercentileApprox,
184
                                                         public MultiExpression,
185
                                                         public NullableAggregateFunction {
186
public:
187
    AggregateFunctionPercentileApproxTwoParams(const DataTypes& argument_types_)
188
626
            : AggregateFunctionPercentileApprox(argument_types_) {}
189
    void add(AggregateDataPtr __restrict place, const IColumn** columns, ssize_t row_num,
190
304
             Arena&) const override {
191
304
        const auto& sources =
192
304
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[0]);
193
304
        const auto& quantile =
194
304
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
195
304
        this->data(place).init(quantile.get_element(0));
196
304
        this->data(place).add(sources.get_element(row_num));
197
304
    }
198
199
120
    DataTypePtr get_return_type() const override { return std::make_shared<DataTypeFloat64>(); }
200
201
102
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
202
102
        auto& col = assert_cast<ColumnFloat64&>(to);
203
102
        double result = AggregateFunctionPercentileApprox::data(place).get();
204
205
102
        if (std::isnan(result)) {
206
1
            col.insert_default();
207
101
        } else {
208
101
            col.get_data().push_back(result);
209
101
        }
210
102
    }
211
};
212
213
class AggregateFunctionPercentileApproxThreeParams final : public AggregateFunctionPercentileApprox,
214
                                                           public MultiExpression,
215
                                                           public NullableAggregateFunction {
216
public:
217
    AggregateFunctionPercentileApproxThreeParams(const DataTypes& argument_types_)
218
37
            : AggregateFunctionPercentileApprox(argument_types_) {}
219
    void add(AggregateDataPtr __restrict place, const IColumn** columns, ssize_t row_num,
220
436
             Arena&) const override {
221
436
        const auto& sources =
222
436
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[0]);
223
436
        const auto& quantile =
224
436
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
225
436
        const auto& compression =
226
436
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[2]);
227
228
436
        this->data(place).init(quantile.get_element(0),
229
436
                               static_cast<float>(compression.get_element(0)));
230
436
        this->data(place).add(sources.get_element(row_num));
231
436
    }
232
233
170
    DataTypePtr get_return_type() const override { return std::make_shared<DataTypeFloat64>(); }
234
235
225
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
236
225
        auto& col = assert_cast<ColumnFloat64&>(to);
237
225
        double result = AggregateFunctionPercentileApprox::data(place).get();
238
239
225
        if (std::isnan(result)) {
240
0
            col.insert_default();
241
225
        } else {
242
225
            col.get_data().push_back(result);
243
225
        }
244
225
    }
245
};
246
247
class AggregateFunctionPercentileApproxWeightedThreeParams final
248
        : public AggregateFunctionPercentileApprox,
249
          MultiExpression,
250
          NullableAggregateFunction {
251
public:
252
    AggregateFunctionPercentileApproxWeightedThreeParams(const DataTypes& argument_types_)
253
23
            : AggregateFunctionPercentileApprox(argument_types_) {}
254
255
    void add(AggregateDataPtr __restrict place, const IColumn** columns, ssize_t row_num,
256
54
             Arena&) const override {
257
54
        const auto& sources =
258
54
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[0]);
259
54
        const auto& weight =
260
54
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
261
54
        const auto& quantile =
262
54
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[2]);
263
264
54
        this->data(place).init(quantile.get_element(0));
265
54
        this->data(place).add_with_weight(sources.get_element(row_num),
266
54
                                          weight.get_element(row_num));
267
54
    }
268
269
55
    DataTypePtr get_return_type() const override { return std::make_shared<DataTypeFloat64>(); }
270
271
27
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
272
27
        auto& col = assert_cast<ColumnFloat64&>(to);
273
27
        double result = AggregateFunctionPercentileApprox::data(place).get();
274
275
27
        if (std::isnan(result)) {
276
1
            col.insert_default();
277
26
        } else {
278
26
            col.get_data().push_back(result);
279
26
        }
280
27
    }
281
};
282
283
class AggregateFunctionPercentileApproxWeightedFourParams final
284
        : public AggregateFunctionPercentileApprox,
285
          MultiExpression,
286
          NullableAggregateFunction {
287
public:
288
    AggregateFunctionPercentileApproxWeightedFourParams(const DataTypes& argument_types_)
289
22
            : AggregateFunctionPercentileApprox(argument_types_) {}
290
    void add(AggregateDataPtr __restrict place, const IColumn** columns, ssize_t row_num,
291
80
             Arena&) const override {
292
80
        const auto& sources =
293
80
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[0]);
294
80
        const auto& weight =
295
80
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
296
80
        const auto& quantile =
297
80
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[2]);
298
80
        const auto& compression =
299
80
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[3]);
300
301
80
        this->data(place).init(quantile.get_element(0),
302
80
                               static_cast<float>(compression.get_element(0)));
303
80
        this->data(place).add_with_weight(sources.get_element(row_num),
304
80
                                          weight.get_element(row_num));
305
80
    }
306
307
43
    DataTypePtr get_return_type() const override { return std::make_shared<DataTypeFloat64>(); }
308
309
10
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
310
10
        auto& col = assert_cast<ColumnFloat64&>(to);
311
10
        double result = AggregateFunctionPercentileApprox::data(place).get();
312
313
10
        if (std::isnan(result)) {
314
0
            col.insert_default();
315
10
        } else {
316
10
            col.get_data().push_back(result);
317
10
        }
318
10
    }
319
};
320
321
template <PrimitiveType T>
322
class PercentileState {
323
public:
324
    using ValueType = typename PrimitiveTypeTraits<T>::CppType;
325
    static constexpr size_t bytes_in_arena = 64 - sizeof(PODArray<ValueType>);
326
    using Array = PODArrayWithStackMemory<ValueType, bytes_in_arena>;
327
328
910
    void add_single_range(const ValueType* data, size_t count, double quantile) {
329
910
        if (!inited_flag) {
330
445
            _set_single_level(quantile);
331
445
            inited_flag = true;
332
445
        }
333
910
        _append(data, count);
334
910
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE3EE16add_single_rangeEPKamd
Line
Count
Source
328
3
    void add_single_range(const ValueType* data, size_t count, double quantile) {
329
3
        if (!inited_flag) {
330
2
            _set_single_level(quantile);
331
2
            inited_flag = true;
332
2
        }
333
3
        _append(data, count);
334
3
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE4EE16add_single_rangeEPKsmd
Line
Count
Source
328
311
    void add_single_range(const ValueType* data, size_t count, double quantile) {
329
311
        if (!inited_flag) {
330
100
            _set_single_level(quantile);
331
100
            inited_flag = true;
332
100
        }
333
311
        _append(data, count);
334
311
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE5EE16add_single_rangeEPKimd
Line
Count
Source
328
231
    void add_single_range(const ValueType* data, size_t count, double quantile) {
329
231
        if (!inited_flag) {
330
70
            _set_single_level(quantile);
331
70
            inited_flag = true;
332
70
        }
333
231
        _append(data, count);
334
231
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE6EE16add_single_rangeEPKlmd
Line
Count
Source
328
319
    void add_single_range(const ValueType* data, size_t count, double quantile) {
329
319
        if (!inited_flag) {
330
247
            _set_single_level(quantile);
331
247
            inited_flag = true;
332
247
        }
333
319
        _append(data, count);
334
319
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE7EE16add_single_rangeEPKnmd
Line
Count
Source
328
3
    void add_single_range(const ValueType* data, size_t count, double quantile) {
329
3
        if (!inited_flag) {
330
2
            _set_single_level(quantile);
331
2
            inited_flag = true;
332
2
        }
333
3
        _append(data, count);
334
3
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE8EE16add_single_rangeEPKfmd
Line
Count
Source
328
3
    void add_single_range(const ValueType* data, size_t count, double quantile) {
329
3
        if (!inited_flag) {
330
2
            _set_single_level(quantile);
331
2
            inited_flag = true;
332
2
        }
333
3
        _append(data, count);
334
3
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE9EE16add_single_rangeEPKdmd
Line
Count
Source
328
40
    void add_single_range(const ValueType* data, size_t count, double quantile) {
329
40
        if (!inited_flag) {
330
22
            _set_single_level(quantile);
331
22
            inited_flag = true;
332
22
        }
333
40
        _append(data, count);
334
40
    }
335
336
    void add_many_range(const ValueType* data, size_t count,
337
                        const PaddedPODArray<Float64>& quantiles_data, const NullMap& null_maps,
338
711
                        size_t start, int64_t arg_size) {
339
711
        if (!inited_flag) {
340
373
            _set_many_levels(quantiles_data, null_maps, start, arg_size);
341
373
            inited_flag = true;
342
373
        }
343
711
        if (levels.empty()) {
344
0
            return;
345
0
        }
346
711
        _append(data, count);
347
711
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE3EE14add_many_rangeEPKamRKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS5_IhLm4096ES8_Lm16ELm15EEEml
Line
Count
Source
338
15
                        size_t start, int64_t arg_size) {
339
15
        if (!inited_flag) {
340
12
            _set_many_levels(quantiles_data, null_maps, start, arg_size);
341
12
            inited_flag = true;
342
12
        }
343
15
        if (levels.empty()) {
344
0
            return;
345
0
        }
346
15
        _append(data, count);
347
15
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE4EE14add_many_rangeEPKsmRKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS5_IhLm4096ES8_Lm16ELm15EEEml
Line
Count
Source
338
18
                        size_t start, int64_t arg_size) {
339
18
        if (!inited_flag) {
340
4
            _set_many_levels(quantiles_data, null_maps, start, arg_size);
341
4
            inited_flag = true;
342
4
        }
343
18
        if (levels.empty()) {
344
0
            return;
345
0
        }
346
18
        _append(data, count);
347
18
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE5EE14add_many_rangeEPKimRKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS5_IhLm4096ES8_Lm16ELm15EEEml
Line
Count
Source
338
573
                        size_t start, int64_t arg_size) {
339
573
        if (!inited_flag) {
340
308
            _set_many_levels(quantiles_data, null_maps, start, arg_size);
341
308
            inited_flag = true;
342
308
        }
343
573
        if (levels.empty()) {
344
0
            return;
345
0
        }
346
573
        _append(data, count);
347
573
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE6EE14add_many_rangeEPKlmRKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS5_IhLm4096ES8_Lm16ELm15EEEml
Line
Count
Source
338
21
                        size_t start, int64_t arg_size) {
339
21
        if (!inited_flag) {
340
6
            _set_many_levels(quantiles_data, null_maps, start, arg_size);
341
6
            inited_flag = true;
342
6
        }
343
21
        if (levels.empty()) {
344
0
            return;
345
0
        }
346
21
        _append(data, count);
347
21
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE7EE14add_many_rangeEPKnmRKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS5_IhLm4096ES8_Lm16ELm15EEEml
Line
Count
Source
338
3
                        size_t start, int64_t arg_size) {
339
3
        if (!inited_flag) {
340
2
            _set_many_levels(quantiles_data, null_maps, start, arg_size);
341
2
            inited_flag = true;
342
2
        }
343
3
        if (levels.empty()) {
344
0
            return;
345
0
        }
346
3
        _append(data, count);
347
3
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE8EE14add_many_rangeEPKfmRKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS5_IhLm4096ES8_Lm16ELm15EEEml
Line
Count
Source
338
3
                        size_t start, int64_t arg_size) {
339
3
        if (!inited_flag) {
340
2
            _set_many_levels(quantiles_data, null_maps, start, arg_size);
341
2
            inited_flag = true;
342
2
        }
343
3
        if (levels.empty()) {
344
0
            return;
345
0
        }
346
3
        _append(data, count);
347
3
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE9EE14add_many_rangeEPKdmRKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS5_IhLm4096ES8_Lm16ELm15EEEml
Line
Count
Source
338
78
                        size_t start, int64_t arg_size) {
339
78
        if (!inited_flag) {
340
39
            _set_many_levels(quantiles_data, null_maps, start, arg_size);
341
39
            inited_flag = true;
342
39
        }
343
78
        if (levels.empty()) {
344
0
            return;
345
0
        }
346
78
        _append(data, count);
347
78
    }
348
349
786
    void write(BufferWritable& buf) const {
350
786
        buf.write_binary(inited_flag);
351
786
        if (!inited_flag) {
352
9
            return;
353
9
        }
354
355
777
        levels.write(buf);
356
777
        size_t size = values.size();
357
777
        buf.write_binary(size);
358
778
        if (size > 0) {
359
778
            buf.write(reinterpret_cast<const char*>(values.data()), sizeof(ValueType) * size);
360
778
        }
361
777
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE3EE5writeERNS_14BufferWritableE
Line
Count
Source
349
4
    void write(BufferWritable& buf) const {
350
4
        buf.write_binary(inited_flag);
351
4
        if (!inited_flag) {
352
0
            return;
353
0
        }
354
355
4
        levels.write(buf);
356
4
        size_t size = values.size();
357
4
        buf.write_binary(size);
358
4
        if (size > 0) {
359
4
            buf.write(reinterpret_cast<const char*>(values.data()), sizeof(ValueType) * size);
360
4
        }
361
4
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE4EE5writeERNS_14BufferWritableE
Line
Count
Source
349
6
    void write(BufferWritable& buf) const {
350
6
        buf.write_binary(inited_flag);
351
6
        if (!inited_flag) {
352
0
            return;
353
0
        }
354
355
6
        levels.write(buf);
356
6
        size_t size = values.size();
357
6
        buf.write_binary(size);
358
6
        if (size > 0) {
359
6
            buf.write(reinterpret_cast<const char*>(values.data()), sizeof(ValueType) * size);
360
6
        }
361
6
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE5EE5writeERNS_14BufferWritableE
Line
Count
Source
349
391
    void write(BufferWritable& buf) const {
350
391
        buf.write_binary(inited_flag);
351
391
        if (!inited_flag) {
352
9
            return;
353
9
        }
354
355
382
        levels.write(buf);
356
382
        size_t size = values.size();
357
382
        buf.write_binary(size);
358
383
        if (size > 0) {
359
383
            buf.write(reinterpret_cast<const char*>(values.data()), sizeof(ValueType) * size);
360
383
        }
361
382
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE6EE5writeERNS_14BufferWritableE
Line
Count
Source
349
339
    void write(BufferWritable& buf) const {
350
339
        buf.write_binary(inited_flag);
351
339
        if (!inited_flag) {
352
0
            return;
353
0
        }
354
355
339
        levels.write(buf);
356
339
        size_t size = values.size();
357
339
        buf.write_binary(size);
358
339
        if (size > 0) {
359
339
            buf.write(reinterpret_cast<const char*>(values.data()), sizeof(ValueType) * size);
360
339
        }
361
339
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE7EE5writeERNS_14BufferWritableE
Line
Count
Source
349
4
    void write(BufferWritable& buf) const {
350
4
        buf.write_binary(inited_flag);
351
4
        if (!inited_flag) {
352
0
            return;
353
0
        }
354
355
4
        levels.write(buf);
356
4
        size_t size = values.size();
357
4
        buf.write_binary(size);
358
4
        if (size > 0) {
359
4
            buf.write(reinterpret_cast<const char*>(values.data()), sizeof(ValueType) * size);
360
4
        }
361
4
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE8EE5writeERNS_14BufferWritableE
Line
Count
Source
349
4
    void write(BufferWritable& buf) const {
350
4
        buf.write_binary(inited_flag);
351
4
        if (!inited_flag) {
352
0
            return;
353
0
        }
354
355
4
        levels.write(buf);
356
4
        size_t size = values.size();
357
4
        buf.write_binary(size);
358
4
        if (size > 0) {
359
4
            buf.write(reinterpret_cast<const char*>(values.data()), sizeof(ValueType) * size);
360
4
        }
361
4
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE9EE5writeERNS_14BufferWritableE
Line
Count
Source
349
38
    void write(BufferWritable& buf) const {
350
38
        buf.write_binary(inited_flag);
351
38
        if (!inited_flag) {
352
0
            return;
353
0
        }
354
355
38
        levels.write(buf);
356
38
        size_t size = values.size();
357
38
        buf.write_binary(size);
358
38
        if (size > 0) {
359
38
            buf.write(reinterpret_cast<const char*>(values.data()), sizeof(ValueType) * size);
360
38
        }
361
38
    }
362
363
733
    void read(BufferReadable& buf) {
364
733
        reset();
365
733
        buf.read_binary(inited_flag);
366
733
        if (!inited_flag) {
367
9
            return;
368
9
        }
369
370
724
        levels.read(buf);
371
724
        size_t size = 0;
372
724
        buf.read_binary(size);
373
724
        values.resize(size);
374
724
        if (size > 0) {
375
723
            auto raw = buf.read(sizeof(ValueType) * size);
376
723
            memcpy(values.data(), raw.data, raw.size);
377
723
        }
378
724
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE3EE4readERNS_14BufferReadableE
Line
Count
Source
363
4
    void read(BufferReadable& buf) {
364
4
        reset();
365
4
        buf.read_binary(inited_flag);
366
4
        if (!inited_flag) {
367
0
            return;
368
0
        }
369
370
4
        levels.read(buf);
371
4
        size_t size = 0;
372
4
        buf.read_binary(size);
373
4
        values.resize(size);
374
4
        if (size > 0) {
375
4
            auto raw = buf.read(sizeof(ValueType) * size);
376
4
            memcpy(values.data(), raw.data, raw.size);
377
4
        }
378
4
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE4EE4readERNS_14BufferReadableE
Line
Count
Source
363
6
    void read(BufferReadable& buf) {
364
6
        reset();
365
6
        buf.read_binary(inited_flag);
366
6
        if (!inited_flag) {
367
0
            return;
368
0
        }
369
370
6
        levels.read(buf);
371
6
        size_t size = 0;
372
6
        buf.read_binary(size);
373
6
        values.resize(size);
374
6
        if (size > 0) {
375
6
            auto raw = buf.read(sizeof(ValueType) * size);
376
6
            memcpy(values.data(), raw.data, raw.size);
377
6
        }
378
6
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE5EE4readERNS_14BufferReadableE
Line
Count
Source
363
353
    void read(BufferReadable& buf) {
364
353
        reset();
365
353
        buf.read_binary(inited_flag);
366
353
        if (!inited_flag) {
367
9
            return;
368
9
        }
369
370
344
        levels.read(buf);
371
344
        size_t size = 0;
372
344
        buf.read_binary(size);
373
344
        values.resize(size);
374
344
        if (size > 0) {
375
343
            auto raw = buf.read(sizeof(ValueType) * size);
376
343
            memcpy(values.data(), raw.data, raw.size);
377
343
        }
378
344
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE6EE4readERNS_14BufferReadableE
Line
Count
Source
363
324
    void read(BufferReadable& buf) {
364
324
        reset();
365
324
        buf.read_binary(inited_flag);
366
324
        if (!inited_flag) {
367
0
            return;
368
0
        }
369
370
324
        levels.read(buf);
371
324
        size_t size = 0;
372
324
        buf.read_binary(size);
373
324
        values.resize(size);
374
324
        if (size > 0) {
375
324
            auto raw = buf.read(sizeof(ValueType) * size);
376
324
            memcpy(values.data(), raw.data, raw.size);
377
324
        }
378
324
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE7EE4readERNS_14BufferReadableE
Line
Count
Source
363
4
    void read(BufferReadable& buf) {
364
4
        reset();
365
4
        buf.read_binary(inited_flag);
366
4
        if (!inited_flag) {
367
0
            return;
368
0
        }
369
370
4
        levels.read(buf);
371
4
        size_t size = 0;
372
4
        buf.read_binary(size);
373
4
        values.resize(size);
374
4
        if (size > 0) {
375
4
            auto raw = buf.read(sizeof(ValueType) * size);
376
4
            memcpy(values.data(), raw.data, raw.size);
377
4
        }
378
4
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE8EE4readERNS_14BufferReadableE
Line
Count
Source
363
4
    void read(BufferReadable& buf) {
364
4
        reset();
365
4
        buf.read_binary(inited_flag);
366
4
        if (!inited_flag) {
367
0
            return;
368
0
        }
369
370
4
        levels.read(buf);
371
4
        size_t size = 0;
372
4
        buf.read_binary(size);
373
4
        values.resize(size);
374
4
        if (size > 0) {
375
4
            auto raw = buf.read(sizeof(ValueType) * size);
376
4
            memcpy(values.data(), raw.data, raw.size);
377
4
        }
378
4
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE9EE4readERNS_14BufferReadableE
Line
Count
Source
363
38
    void read(BufferReadable& buf) {
364
38
        reset();
365
38
        buf.read_binary(inited_flag);
366
38
        if (!inited_flag) {
367
0
            return;
368
0
        }
369
370
38
        levels.read(buf);
371
38
        size_t size = 0;
372
38
        buf.read_binary(size);
373
38
        values.resize(size);
374
38
        if (size > 0) {
375
38
            auto raw = buf.read(sizeof(ValueType) * size);
376
38
            memcpy(values.data(), raw.data, raw.size);
377
38
        }
378
38
    }
379
380
731
    void merge(const PercentileState& rhs) {
381
731
        if (!rhs.inited_flag) {
382
9
            return;
383
9
        }
384
385
722
        if (!inited_flag) {
386
432
            levels = rhs.levels;
387
432
            inited_flag = true;
388
432
        } else {
389
290
            levels.merge(rhs.levels);
390
290
        }
391
722
        _append(rhs.values.data(), rhs.values.size());
392
722
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE3EE5mergeERKS2_
Line
Count
Source
380
4
    void merge(const PercentileState& rhs) {
381
4
        if (!rhs.inited_flag) {
382
0
            return;
383
0
        }
384
385
4
        if (!inited_flag) {
386
2
            levels = rhs.levels;
387
2
            inited_flag = true;
388
2
        } else {
389
2
            levels.merge(rhs.levels);
390
2
        }
391
4
        _append(rhs.values.data(), rhs.values.size());
392
4
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE4EE5mergeERKS2_
Line
Count
Source
380
6
    void merge(const PercentileState& rhs) {
381
6
        if (!rhs.inited_flag) {
382
0
            return;
383
0
        }
384
385
6
        if (!inited_flag) {
386
3
            levels = rhs.levels;
387
3
            inited_flag = true;
388
3
        } else {
389
3
            levels.merge(rhs.levels);
390
3
        }
391
6
        _append(rhs.values.data(), rhs.values.size());
392
6
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE5EE5mergeERKS2_
Line
Count
Source
380
351
    void merge(const PercentileState& rhs) {
381
351
        if (!rhs.inited_flag) {
382
9
            return;
383
9
        }
384
385
342
        if (!inited_flag) {
386
218
            levels = rhs.levels;
387
218
            inited_flag = true;
388
218
        } else {
389
124
            levels.merge(rhs.levels);
390
124
        }
391
342
        _append(rhs.values.data(), rhs.values.size());
392
342
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE6EE5mergeERKS2_
Line
Count
Source
380
324
    void merge(const PercentileState& rhs) {
381
324
        if (!rhs.inited_flag) {
382
0
            return;
383
0
        }
384
385
324
        if (!inited_flag) {
386
181
            levels = rhs.levels;
387
181
            inited_flag = true;
388
181
        } else {
389
143
            levels.merge(rhs.levels);
390
143
        }
391
324
        _append(rhs.values.data(), rhs.values.size());
392
324
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE7EE5mergeERKS2_
Line
Count
Source
380
4
    void merge(const PercentileState& rhs) {
381
4
        if (!rhs.inited_flag) {
382
0
            return;
383
0
        }
384
385
4
        if (!inited_flag) {
386
2
            levels = rhs.levels;
387
2
            inited_flag = true;
388
2
        } else {
389
2
            levels.merge(rhs.levels);
390
2
        }
391
4
        _append(rhs.values.data(), rhs.values.size());
392
4
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE8EE5mergeERKS2_
Line
Count
Source
380
4
    void merge(const PercentileState& rhs) {
381
4
        if (!rhs.inited_flag) {
382
0
            return;
383
0
        }
384
385
4
        if (!inited_flag) {
386
2
            levels = rhs.levels;
387
2
            inited_flag = true;
388
2
        } else {
389
2
            levels.merge(rhs.levels);
390
2
        }
391
4
        _append(rhs.values.data(), rhs.values.size());
392
4
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE9EE5mergeERKS2_
Line
Count
Source
380
38
    void merge(const PercentileState& rhs) {
381
38
        if (!rhs.inited_flag) {
382
0
            return;
383
0
        }
384
385
38
        if (!inited_flag) {
386
24
            levels = rhs.levels;
387
24
            inited_flag = true;
388
24
        } else {
389
14
            levels.merge(rhs.levels);
390
14
        }
391
38
        _append(rhs.values.data(), rhs.values.size());
392
38
    }
393
394
967
    void reset() {
395
967
        values.clear();
396
967
        levels.clear();
397
967
        inited_flag = false;
398
967
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE3EE5resetEv
Line
Count
Source
394
4
    void reset() {
395
4
        values.clear();
396
4
        levels.clear();
397
4
        inited_flag = false;
398
4
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE4EE5resetEv
Line
Count
Source
394
108
    void reset() {
395
108
        values.clear();
396
108
        levels.clear();
397
108
        inited_flag = false;
398
108
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE5EE5resetEv
Line
Count
Source
394
388
    void reset() {
395
388
        values.clear();
396
388
        levels.clear();
397
388
        inited_flag = false;
398
388
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE6EE5resetEv
Line
Count
Source
394
415
    void reset() {
395
415
        values.clear();
396
415
        levels.clear();
397
415
        inited_flag = false;
398
415
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE7EE5resetEv
Line
Count
Source
394
4
    void reset() {
395
4
        values.clear();
396
4
        levels.clear();
397
4
        inited_flag = false;
398
4
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE8EE5resetEv
Line
Count
Source
394
4
    void reset() {
395
4
        values.clear();
396
4
        levels.clear();
397
4
        inited_flag = false;
398
4
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE9EE5resetEv
Line
Count
Source
394
44
    void reset() {
395
44
        values.clear();
396
44
        levels.clear();
397
44
        inited_flag = false;
398
44
    }
399
400
359
    double get() const {
401
359
        if (!inited_flag || levels.empty() || values.empty()) {
402
2
            return 0.0;
403
2
        }
404
405
359
        DCHECK_EQ(levels.quantiles.size(), 1);
406
357
        return _get_float(levels.quantiles[0]);
407
359
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE3EE3getEv
Line
Count
Source
400
2
    double get() const {
401
2
        if (!inited_flag || levels.empty() || values.empty()) {
402
1
            return 0.0;
403
1
        }
404
405
2
        DCHECK_EQ(levels.quantiles.size(), 1);
406
1
        return _get_float(levels.quantiles[0]);
407
2
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE4EE3getEv
Line
Count
Source
400
177
    double get() const {
401
177
        if (!inited_flag || levels.empty() || values.empty()) {
402
0
            return 0.0;
403
0
        }
404
405
177
        DCHECK_EQ(levels.quantiles.size(), 1);
406
177
        return _get_float(levels.quantiles[0]);
407
177
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE5EE3getEv
Line
Count
Source
400
54
    double get() const {
401
54
        if (!inited_flag || levels.empty() || values.empty()) {
402
0
            return 0.0;
403
0
        }
404
405
54
        DCHECK_EQ(levels.quantiles.size(), 1);
406
54
        return _get_float(levels.quantiles[0]);
407
54
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE6EE3getEv
Line
Count
Source
400
91
    double get() const {
401
91
        if (!inited_flag || levels.empty() || values.empty()) {
402
1
            return 0.0;
403
1
        }
404
405
91
        DCHECK_EQ(levels.quantiles.size(), 1);
406
90
        return _get_float(levels.quantiles[0]);
407
91
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE7EE3getEv
Line
Count
Source
400
1
    double get() const {
401
1
        if (!inited_flag || levels.empty() || values.empty()) {
402
0
            return 0.0;
403
0
        }
404
405
1
        DCHECK_EQ(levels.quantiles.size(), 1);
406
1
        return _get_float(levels.quantiles[0]);
407
1
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE8EE3getEv
Line
Count
Source
400
1
    double get() const {
401
1
        if (!inited_flag || levels.empty() || values.empty()) {
402
0
            return 0.0;
403
0
        }
404
405
1
        DCHECK_EQ(levels.quantiles.size(), 1);
406
1
        return _get_float(levels.quantiles[0]);
407
1
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE9EE3getEv
Line
Count
Source
400
33
    double get() const {
401
33
        if (!inited_flag || levels.empty() || values.empty()) {
402
0
            return 0.0;
403
0
        }
404
405
33
        DCHECK_EQ(levels.quantiles.size(), 1);
406
33
        return _get_float(levels.quantiles[0]);
407
33
    }
408
409
217
    void insert_result_into(IColumn& to) const {
410
217
        auto& column_data = assert_cast<ColumnFloat64&>(to).get_data();
411
217
        if (!inited_flag || levels.empty() || values.empty()) {
412
3
            return;
413
3
        }
414
415
214
        size_t old_size = column_data.size();
416
214
        size_t size = levels.quantiles.size();
417
214
        column_data.resize(old_size + size);
418
214
        auto* result = column_data.data() + old_size;
419
420
214
        if (values.size() == 1) {
421
324
            for (size_t i = 0; i < size; ++i) {
422
224
                result[i] = static_cast<double>(values.front());
423
224
            }
424
100
            return;
425
100
        }
426
114
        size_t prev_n = 0;
427
114
        const auto& quantiles = levels.quantiles;
428
114
        const auto& permutation = levels.permutation;
429
381
        for (size_t i = 0; i < size; ++i) {
430
267
            auto level_index = permutation[i];
431
267
            auto level = quantiles[level_index];
432
267
            double h = level * static_cast<double>(values.size() - 1) + 1;
433
267
            auto n = static_cast<size_t>(h);
434
435
267
            if (n >= values.size()) {
436
0
                result[level_index] =
437
0
                        static_cast<double>(*std::max_element(values.begin(), values.end()));
438
267
            } else if (n < 1) {
439
0
                result[level_index] =
440
0
                        static_cast<double>(*std::min_element(values.begin(), values.end()));
441
267
            } else {
442
267
                std::nth_element(values.begin() + prev_n, values.begin() + n - 1, values.end());
443
267
                auto* nth_elem = std::min_element(values.begin() + n, values.end());
444
267
                result[level_index] =
445
267
                        static_cast<double>(values[n - 1]) +
446
267
                        (h - static_cast<double>(n)) * (static_cast<double>(*nth_elem) -
447
267
                                                        static_cast<double>(values[n - 1]));
448
267
                prev_n = n - 1;
449
267
            }
450
267
        }
451
114
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE3EE18insert_result_intoERNS_7IColumnE
Line
Count
Source
409
11
    void insert_result_into(IColumn& to) const {
410
11
        auto& column_data = assert_cast<ColumnFloat64&>(to).get_data();
411
11
        if (!inited_flag || levels.empty() || values.empty()) {
412
0
            return;
413
0
        }
414
415
11
        size_t old_size = column_data.size();
416
11
        size_t size = levels.quantiles.size();
417
11
        column_data.resize(old_size + size);
418
11
        auto* result = column_data.data() + old_size;
419
420
11
        if (values.size() == 1) {
421
32
            for (size_t i = 0; i < size; ++i) {
422
24
                result[i] = static_cast<double>(values.front());
423
24
            }
424
8
            return;
425
8
        }
426
3
        size_t prev_n = 0;
427
3
        const auto& quantiles = levels.quantiles;
428
3
        const auto& permutation = levels.permutation;
429
11
        for (size_t i = 0; i < size; ++i) {
430
8
            auto level_index = permutation[i];
431
8
            auto level = quantiles[level_index];
432
8
            double h = level * static_cast<double>(values.size() - 1) + 1;
433
8
            auto n = static_cast<size_t>(h);
434
435
8
            if (n >= values.size()) {
436
0
                result[level_index] =
437
0
                        static_cast<double>(*std::max_element(values.begin(), values.end()));
438
8
            } else if (n < 1) {
439
0
                result[level_index] =
440
0
                        static_cast<double>(*std::min_element(values.begin(), values.end()));
441
8
            } else {
442
8
                std::nth_element(values.begin() + prev_n, values.begin() + n - 1, values.end());
443
8
                auto* nth_elem = std::min_element(values.begin() + n, values.end());
444
8
                result[level_index] =
445
8
                        static_cast<double>(values[n - 1]) +
446
8
                        (h - static_cast<double>(n)) * (static_cast<double>(*nth_elem) -
447
8
                                                        static_cast<double>(values[n - 1]));
448
8
                prev_n = n - 1;
449
8
            }
450
8
        }
451
3
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE4EE18insert_result_intoERNS_7IColumnE
Line
Count
Source
409
2
    void insert_result_into(IColumn& to) const {
410
2
        auto& column_data = assert_cast<ColumnFloat64&>(to).get_data();
411
2
        if (!inited_flag || levels.empty() || values.empty()) {
412
0
            return;
413
0
        }
414
415
2
        size_t old_size = column_data.size();
416
2
        size_t size = levels.quantiles.size();
417
2
        column_data.resize(old_size + size);
418
2
        auto* result = column_data.data() + old_size;
419
420
2
        if (values.size() == 1) {
421
0
            for (size_t i = 0; i < size; ++i) {
422
0
                result[i] = static_cast<double>(values.front());
423
0
            }
424
0
            return;
425
0
        }
426
2
        size_t prev_n = 0;
427
2
        const auto& quantiles = levels.quantiles;
428
2
        const auto& permutation = levels.permutation;
429
7
        for (size_t i = 0; i < size; ++i) {
430
5
            auto level_index = permutation[i];
431
5
            auto level = quantiles[level_index];
432
5
            double h = level * static_cast<double>(values.size() - 1) + 1;
433
5
            auto n = static_cast<size_t>(h);
434
435
5
            if (n >= values.size()) {
436
0
                result[level_index] =
437
0
                        static_cast<double>(*std::max_element(values.begin(), values.end()));
438
5
            } else if (n < 1) {
439
0
                result[level_index] =
440
0
                        static_cast<double>(*std::min_element(values.begin(), values.end()));
441
5
            } else {
442
5
                std::nth_element(values.begin() + prev_n, values.begin() + n - 1, values.end());
443
5
                auto* nth_elem = std::min_element(values.begin() + n, values.end());
444
5
                result[level_index] =
445
5
                        static_cast<double>(values[n - 1]) +
446
5
                        (h - static_cast<double>(n)) * (static_cast<double>(*nth_elem) -
447
5
                                                        static_cast<double>(values[n - 1]));
448
5
                prev_n = n - 1;
449
5
            }
450
5
        }
451
2
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE5EE18insert_result_intoERNS_7IColumnE
Line
Count
Source
409
160
    void insert_result_into(IColumn& to) const {
410
160
        auto& column_data = assert_cast<ColumnFloat64&>(to).get_data();
411
160
        if (!inited_flag || levels.empty() || values.empty()) {
412
3
            return;
413
3
        }
414
415
157
        size_t old_size = column_data.size();
416
157
        size_t size = levels.quantiles.size();
417
157
        column_data.resize(old_size + size);
418
157
        auto* result = column_data.data() + old_size;
419
420
157
        if (values.size() == 1) {
421
265
            for (size_t i = 0; i < size; ++i) {
422
182
                result[i] = static_cast<double>(values.front());
423
182
            }
424
83
            return;
425
83
        }
426
74
        size_t prev_n = 0;
427
74
        const auto& quantiles = levels.quantiles;
428
74
        const auto& permutation = levels.permutation;
429
237
        for (size_t i = 0; i < size; ++i) {
430
163
            auto level_index = permutation[i];
431
163
            auto level = quantiles[level_index];
432
163
            double h = level * static_cast<double>(values.size() - 1) + 1;
433
163
            auto n = static_cast<size_t>(h);
434
435
163
            if (n >= values.size()) {
436
0
                result[level_index] =
437
0
                        static_cast<double>(*std::max_element(values.begin(), values.end()));
438
163
            } else if (n < 1) {
439
0
                result[level_index] =
440
0
                        static_cast<double>(*std::min_element(values.begin(), values.end()));
441
163
            } else {
442
163
                std::nth_element(values.begin() + prev_n, values.begin() + n - 1, values.end());
443
163
                auto* nth_elem = std::min_element(values.begin() + n, values.end());
444
163
                result[level_index] =
445
163
                        static_cast<double>(values[n - 1]) +
446
163
                        (h - static_cast<double>(n)) * (static_cast<double>(*nth_elem) -
447
163
                                                        static_cast<double>(values[n - 1]));
448
163
                prev_n = n - 1;
449
163
            }
450
163
        }
451
74
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE6EE18insert_result_intoERNS_7IColumnE
Line
Count
Source
409
2
    void insert_result_into(IColumn& to) const {
410
2
        auto& column_data = assert_cast<ColumnFloat64&>(to).get_data();
411
2
        if (!inited_flag || levels.empty() || values.empty()) {
412
0
            return;
413
0
        }
414
415
2
        size_t old_size = column_data.size();
416
2
        size_t size = levels.quantiles.size();
417
2
        column_data.resize(old_size + size);
418
2
        auto* result = column_data.data() + old_size;
419
420
2
        if (values.size() == 1) {
421
0
            for (size_t i = 0; i < size; ++i) {
422
0
                result[i] = static_cast<double>(values.front());
423
0
            }
424
0
            return;
425
0
        }
426
2
        size_t prev_n = 0;
427
2
        const auto& quantiles = levels.quantiles;
428
2
        const auto& permutation = levels.permutation;
429
7
        for (size_t i = 0; i < size; ++i) {
430
5
            auto level_index = permutation[i];
431
5
            auto level = quantiles[level_index];
432
5
            double h = level * static_cast<double>(values.size() - 1) + 1;
433
5
            auto n = static_cast<size_t>(h);
434
435
5
            if (n >= values.size()) {
436
0
                result[level_index] =
437
0
                        static_cast<double>(*std::max_element(values.begin(), values.end()));
438
5
            } else if (n < 1) {
439
0
                result[level_index] =
440
0
                        static_cast<double>(*std::min_element(values.begin(), values.end()));
441
5
            } else {
442
5
                std::nth_element(values.begin() + prev_n, values.begin() + n - 1, values.end());
443
5
                auto* nth_elem = std::min_element(values.begin() + n, values.end());
444
5
                result[level_index] =
445
5
                        static_cast<double>(values[n - 1]) +
446
5
                        (h - static_cast<double>(n)) * (static_cast<double>(*nth_elem) -
447
5
                                                        static_cast<double>(values[n - 1]));
448
5
                prev_n = n - 1;
449
5
            }
450
5
        }
451
2
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE7EE18insert_result_intoERNS_7IColumnE
Line
Count
Source
409
1
    void insert_result_into(IColumn& to) const {
410
1
        auto& column_data = assert_cast<ColumnFloat64&>(to).get_data();
411
1
        if (!inited_flag || levels.empty() || values.empty()) {
412
0
            return;
413
0
        }
414
415
1
        size_t old_size = column_data.size();
416
1
        size_t size = levels.quantiles.size();
417
1
        column_data.resize(old_size + size);
418
1
        auto* result = column_data.data() + old_size;
419
420
1
        if (values.size() == 1) {
421
0
            for (size_t i = 0; i < size; ++i) {
422
0
                result[i] = static_cast<double>(values.front());
423
0
            }
424
0
            return;
425
0
        }
426
1
        size_t prev_n = 0;
427
1
        const auto& quantiles = levels.quantiles;
428
1
        const auto& permutation = levels.permutation;
429
3
        for (size_t i = 0; i < size; ++i) {
430
2
            auto level_index = permutation[i];
431
2
            auto level = quantiles[level_index];
432
2
            double h = level * static_cast<double>(values.size() - 1) + 1;
433
2
            auto n = static_cast<size_t>(h);
434
435
2
            if (n >= values.size()) {
436
0
                result[level_index] =
437
0
                        static_cast<double>(*std::max_element(values.begin(), values.end()));
438
2
            } else if (n < 1) {
439
0
                result[level_index] =
440
0
                        static_cast<double>(*std::min_element(values.begin(), values.end()));
441
2
            } else {
442
2
                std::nth_element(values.begin() + prev_n, values.begin() + n - 1, values.end());
443
2
                auto* nth_elem = std::min_element(values.begin() + n, values.end());
444
2
                result[level_index] =
445
2
                        static_cast<double>(values[n - 1]) +
446
2
                        (h - static_cast<double>(n)) * (static_cast<double>(*nth_elem) -
447
2
                                                        static_cast<double>(values[n - 1]));
448
2
                prev_n = n - 1;
449
2
            }
450
2
        }
451
1
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE8EE18insert_result_intoERNS_7IColumnE
Line
Count
Source
409
1
    void insert_result_into(IColumn& to) const {
410
1
        auto& column_data = assert_cast<ColumnFloat64&>(to).get_data();
411
1
        if (!inited_flag || levels.empty() || values.empty()) {
412
0
            return;
413
0
        }
414
415
1
        size_t old_size = column_data.size();
416
1
        size_t size = levels.quantiles.size();
417
1
        column_data.resize(old_size + size);
418
1
        auto* result = column_data.data() + old_size;
419
420
1
        if (values.size() == 1) {
421
0
            for (size_t i = 0; i < size; ++i) {
422
0
                result[i] = static_cast<double>(values.front());
423
0
            }
424
0
            return;
425
0
        }
426
1
        size_t prev_n = 0;
427
1
        const auto& quantiles = levels.quantiles;
428
1
        const auto& permutation = levels.permutation;
429
3
        for (size_t i = 0; i < size; ++i) {
430
2
            auto level_index = permutation[i];
431
2
            auto level = quantiles[level_index];
432
2
            double h = level * static_cast<double>(values.size() - 1) + 1;
433
2
            auto n = static_cast<size_t>(h);
434
435
2
            if (n >= values.size()) {
436
0
                result[level_index] =
437
0
                        static_cast<double>(*std::max_element(values.begin(), values.end()));
438
2
            } else if (n < 1) {
439
0
                result[level_index] =
440
0
                        static_cast<double>(*std::min_element(values.begin(), values.end()));
441
2
            } else {
442
2
                std::nth_element(values.begin() + prev_n, values.begin() + n - 1, values.end());
443
2
                auto* nth_elem = std::min_element(values.begin() + n, values.end());
444
2
                result[level_index] =
445
2
                        static_cast<double>(values[n - 1]) +
446
2
                        (h - static_cast<double>(n)) * (static_cast<double>(*nth_elem) -
447
2
                                                        static_cast<double>(values[n - 1]));
448
2
                prev_n = n - 1;
449
2
            }
450
2
        }
451
1
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE9EE18insert_result_intoERNS_7IColumnE
Line
Count
Source
409
40
    void insert_result_into(IColumn& to) const {
410
40
        auto& column_data = assert_cast<ColumnFloat64&>(to).get_data();
411
40
        if (!inited_flag || levels.empty() || values.empty()) {
412
0
            return;
413
0
        }
414
415
40
        size_t old_size = column_data.size();
416
40
        size_t size = levels.quantiles.size();
417
40
        column_data.resize(old_size + size);
418
40
        auto* result = column_data.data() + old_size;
419
420
40
        if (values.size() == 1) {
421
27
            for (size_t i = 0; i < size; ++i) {
422
18
                result[i] = static_cast<double>(values.front());
423
18
            }
424
9
            return;
425
9
        }
426
31
        size_t prev_n = 0;
427
31
        const auto& quantiles = levels.quantiles;
428
31
        const auto& permutation = levels.permutation;
429
113
        for (size_t i = 0; i < size; ++i) {
430
82
            auto level_index = permutation[i];
431
82
            auto level = quantiles[level_index];
432
82
            double h = level * static_cast<double>(values.size() - 1) + 1;
433
82
            auto n = static_cast<size_t>(h);
434
435
82
            if (n >= values.size()) {
436
0
                result[level_index] =
437
0
                        static_cast<double>(*std::max_element(values.begin(), values.end()));
438
82
            } else if (n < 1) {
439
0
                result[level_index] =
440
0
                        static_cast<double>(*std::min_element(values.begin(), values.end()));
441
82
            } else {
442
82
                std::nth_element(values.begin() + prev_n, values.begin() + n - 1, values.end());
443
82
                auto* nth_elem = std::min_element(values.begin() + n, values.end());
444
82
                result[level_index] =
445
82
                        static_cast<double>(values[n - 1]) +
446
82
                        (h - static_cast<double>(n)) * (static_cast<double>(*nth_elem) -
447
82
                                                        static_cast<double>(values[n - 1]));
448
82
                prev_n = n - 1;
449
82
            }
450
82
        }
451
31
    }
452
453
private:
454
445
    void _set_single_level(double quantile) {
455
445
        DCHECK(levels.empty());
456
445
        check_quantile(quantile);
457
445
        levels.quantiles.push_back(quantile);
458
445
        levels.permutation.push_back(0);
459
445
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE3EE17_set_single_levelEd
Line
Count
Source
454
2
    void _set_single_level(double quantile) {
455
        DCHECK(levels.empty());
456
2
        check_quantile(quantile);
457
2
        levels.quantiles.push_back(quantile);
458
2
        levels.permutation.push_back(0);
459
2
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE4EE17_set_single_levelEd
Line
Count
Source
454
100
    void _set_single_level(double quantile) {
455
        DCHECK(levels.empty());
456
100
        check_quantile(quantile);
457
100
        levels.quantiles.push_back(quantile);
458
100
        levels.permutation.push_back(0);
459
100
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE5EE17_set_single_levelEd
Line
Count
Source
454
70
    void _set_single_level(double quantile) {
455
        DCHECK(levels.empty());
456
70
        check_quantile(quantile);
457
70
        levels.quantiles.push_back(quantile);
458
70
        levels.permutation.push_back(0);
459
70
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE6EE17_set_single_levelEd
Line
Count
Source
454
247
    void _set_single_level(double quantile) {
455
        DCHECK(levels.empty());
456
247
        check_quantile(quantile);
457
247
        levels.quantiles.push_back(quantile);
458
247
        levels.permutation.push_back(0);
459
247
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE7EE17_set_single_levelEd
Line
Count
Source
454
2
    void _set_single_level(double quantile) {
455
        DCHECK(levels.empty());
456
2
        check_quantile(quantile);
457
2
        levels.quantiles.push_back(quantile);
458
2
        levels.permutation.push_back(0);
459
2
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE8EE17_set_single_levelEd
Line
Count
Source
454
2
    void _set_single_level(double quantile) {
455
        DCHECK(levels.empty());
456
2
        check_quantile(quantile);
457
2
        levels.quantiles.push_back(quantile);
458
2
        levels.permutation.push_back(0);
459
2
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE9EE17_set_single_levelEd
Line
Count
Source
454
22
    void _set_single_level(double quantile) {
455
        DCHECK(levels.empty());
456
22
        check_quantile(quantile);
457
22
        levels.quantiles.push_back(quantile);
458
22
        levels.permutation.push_back(0);
459
22
    }
460
461
    void _set_many_levels(const PaddedPODArray<Float64>& quantiles_data, const NullMap& null_maps,
462
372
                          size_t start, int64_t arg_size) {
463
372
        DCHECK(levels.empty());
464
372
        size_t size = cast_set<size_t>(arg_size);
465
372
        levels.quantiles.resize(size);
466
372
        levels.permutation.resize(size);
467
1.27k
        for (size_t i = 0; i < size; ++i) {
468
900
            if (null_maps[start + i]) {
469
1
                throw Exception(ErrorCode::INVALID_ARGUMENT,
470
1
                                "quantiles in func percentile_array should not have null");
471
1
            }
472
899
            check_quantile(quantiles_data[start + i]);
473
899
            levels.quantiles[i] = quantiles_data[start + i];
474
899
            levels.permutation[i] = i;
475
899
        }
476
371
        levels.sort_permutation();
477
371
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE3EE16_set_many_levelsERKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS3_IhLm4096ES6_Lm16ELm15EEEml
Line
Count
Source
462
12
                          size_t start, int64_t arg_size) {
463
12
        DCHECK(levels.empty());
464
12
        size_t size = cast_set<size_t>(arg_size);
465
12
        levels.quantiles.resize(size);
466
12
        levels.permutation.resize(size);
467
46
        for (size_t i = 0; i < size; ++i) {
468
34
            if (null_maps[start + i]) {
469
0
                throw Exception(ErrorCode::INVALID_ARGUMENT,
470
0
                                "quantiles in func percentile_array should not have null");
471
0
            }
472
34
            check_quantile(quantiles_data[start + i]);
473
34
            levels.quantiles[i] = quantiles_data[start + i];
474
34
            levels.permutation[i] = i;
475
34
        }
476
12
        levels.sort_permutation();
477
12
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE4EE16_set_many_levelsERKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS3_IhLm4096ES6_Lm16ELm15EEEml
Line
Count
Source
462
4
                          size_t start, int64_t arg_size) {
463
4
        DCHECK(levels.empty());
464
4
        size_t size = cast_set<size_t>(arg_size);
465
4
        levels.quantiles.resize(size);
466
4
        levels.permutation.resize(size);
467
14
        for (size_t i = 0; i < size; ++i) {
468
10
            if (null_maps[start + i]) {
469
0
                throw Exception(ErrorCode::INVALID_ARGUMENT,
470
0
                                "quantiles in func percentile_array should not have null");
471
0
            }
472
10
            check_quantile(quantiles_data[start + i]);
473
10
            levels.quantiles[i] = quantiles_data[start + i];
474
10
            levels.permutation[i] = i;
475
10
        }
476
4
        levels.sort_permutation();
477
4
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE5EE16_set_many_levelsERKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS3_IhLm4096ES6_Lm16ELm15EEEml
Line
Count
Source
462
307
                          size_t start, int64_t arg_size) {
463
307
        DCHECK(levels.empty());
464
307
        size_t size = cast_set<size_t>(arg_size);
465
307
        levels.quantiles.resize(size);
466
307
        levels.permutation.resize(size);
467
1.05k
        for (size_t i = 0; i < size; ++i) {
468
750
            if (null_maps[start + i]) {
469
0
                throw Exception(ErrorCode::INVALID_ARGUMENT,
470
0
                                "quantiles in func percentile_array should not have null");
471
0
            }
472
750
            check_quantile(quantiles_data[start + i]);
473
750
            levels.quantiles[i] = quantiles_data[start + i];
474
750
            levels.permutation[i] = i;
475
750
        }
476
307
        levels.sort_permutation();
477
307
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE6EE16_set_many_levelsERKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS3_IhLm4096ES6_Lm16ELm15EEEml
Line
Count
Source
462
6
                          size_t start, int64_t arg_size) {
463
6
        DCHECK(levels.empty());
464
6
        size_t size = cast_set<size_t>(arg_size);
465
6
        levels.quantiles.resize(size);
466
6
        levels.permutation.resize(size);
467
19
        for (size_t i = 0; i < size; ++i) {
468
14
            if (null_maps[start + i]) {
469
1
                throw Exception(ErrorCode::INVALID_ARGUMENT,
470
1
                                "quantiles in func percentile_array should not have null");
471
1
            }
472
13
            check_quantile(quantiles_data[start + i]);
473
13
            levels.quantiles[i] = quantiles_data[start + i];
474
13
            levels.permutation[i] = i;
475
13
        }
476
5
        levels.sort_permutation();
477
5
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE7EE16_set_many_levelsERKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS3_IhLm4096ES6_Lm16ELm15EEEml
Line
Count
Source
462
2
                          size_t start, int64_t arg_size) {
463
2
        DCHECK(levels.empty());
464
2
        size_t size = cast_set<size_t>(arg_size);
465
2
        levels.quantiles.resize(size);
466
2
        levels.permutation.resize(size);
467
6
        for (size_t i = 0; i < size; ++i) {
468
4
            if (null_maps[start + i]) {
469
0
                throw Exception(ErrorCode::INVALID_ARGUMENT,
470
0
                                "quantiles in func percentile_array should not have null");
471
0
            }
472
4
            check_quantile(quantiles_data[start + i]);
473
4
            levels.quantiles[i] = quantiles_data[start + i];
474
4
            levels.permutation[i] = i;
475
4
        }
476
2
        levels.sort_permutation();
477
2
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE8EE16_set_many_levelsERKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS3_IhLm4096ES6_Lm16ELm15EEEml
Line
Count
Source
462
2
                          size_t start, int64_t arg_size) {
463
2
        DCHECK(levels.empty());
464
2
        size_t size = cast_set<size_t>(arg_size);
465
2
        levels.quantiles.resize(size);
466
2
        levels.permutation.resize(size);
467
6
        for (size_t i = 0; i < size; ++i) {
468
4
            if (null_maps[start + i]) {
469
0
                throw Exception(ErrorCode::INVALID_ARGUMENT,
470
0
                                "quantiles in func percentile_array should not have null");
471
0
            }
472
4
            check_quantile(quantiles_data[start + i]);
473
4
            levels.quantiles[i] = quantiles_data[start + i];
474
4
            levels.permutation[i] = i;
475
4
        }
476
2
        levels.sort_permutation();
477
2
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE9EE16_set_many_levelsERKNS_8PODArrayIdLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERKNS3_IhLm4096ES6_Lm16ELm15EEEml
Line
Count
Source
462
39
                          size_t start, int64_t arg_size) {
463
39
        DCHECK(levels.empty());
464
39
        size_t size = cast_set<size_t>(arg_size);
465
39
        levels.quantiles.resize(size);
466
39
        levels.permutation.resize(size);
467
123
        for (size_t i = 0; i < size; ++i) {
468
84
            if (null_maps[start + i]) {
469
0
                throw Exception(ErrorCode::INVALID_ARGUMENT,
470
0
                                "quantiles in func percentile_array should not have null");
471
0
            }
472
84
            check_quantile(quantiles_data[start + i]);
473
84
            levels.quantiles[i] = quantiles_data[start + i];
474
84
            levels.permutation[i] = i;
475
84
        }
476
39
        levels.sort_permutation();
477
39
    }
478
479
2.33k
    void _append(const ValueType* data, size_t count) {
480
2.33k
        if (count == 0) {
481
0
            return;
482
0
        }
483
2.33k
        values.reserve(values.size() + count);
484
2.33k
        values.insert_assume_reserved(data, data + count);
485
2.33k
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE3EE7_appendEPKam
Line
Count
Source
479
22
    void _append(const ValueType* data, size_t count) {
480
22
        if (count == 0) {
481
0
            return;
482
0
        }
483
22
        values.reserve(values.size() + count);
484
22
        values.insert_assume_reserved(data, data + count);
485
22
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE4EE7_appendEPKsm
Line
Count
Source
479
335
    void _append(const ValueType* data, size_t count) {
480
335
        if (count == 0) {
481
0
            return;
482
0
        }
483
335
        values.reserve(values.size() + count);
484
335
        values.insert_assume_reserved(data, data + count);
485
335
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE5EE7_appendEPKim
Line
Count
Source
479
1.14k
    void _append(const ValueType* data, size_t count) {
480
1.14k
        if (count == 0) {
481
0
            return;
482
0
        }
483
1.14k
        values.reserve(values.size() + count);
484
1.14k
        values.insert_assume_reserved(data, data + count);
485
1.14k
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE6EE7_appendEPKlm
Line
Count
Source
479
661
    void _append(const ValueType* data, size_t count) {
480
661
        if (count == 0) {
481
0
            return;
482
0
        }
483
661
        values.reserve(values.size() + count);
484
661
        values.insert_assume_reserved(data, data + count);
485
661
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE7EE7_appendEPKnm
Line
Count
Source
479
10
    void _append(const ValueType* data, size_t count) {
480
10
        if (count == 0) {
481
0
            return;
482
0
        }
483
10
        values.reserve(values.size() + count);
484
10
        values.insert_assume_reserved(data, data + count);
485
10
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE8EE7_appendEPKfm
Line
Count
Source
479
10
    void _append(const ValueType* data, size_t count) {
480
10
        if (count == 0) {
481
0
            return;
482
0
        }
483
10
        values.reserve(values.size() + count);
484
10
        values.insert_assume_reserved(data, data + count);
485
10
    }
_ZN5doris15PercentileStateILNS_13PrimitiveTypeE9EE7_appendEPKdm
Line
Count
Source
479
154
    void _append(const ValueType* data, size_t count) {
480
154
        if (count == 0) {
481
0
            return;
482
0
        }
483
154
        values.reserve(values.size() + count);
484
154
        values.insert_assume_reserved(data, data + count);
485
154
    }
486
487
357
    double _get_float(double quantile) const {
488
357
        if (values.size() == 1) {
489
110
            return static_cast<double>(values.front());
490
110
        }
491
492
247
        double h = quantile * static_cast<double>(values.size() - 1) + 1;
493
247
        auto n = static_cast<size_t>(h);
494
495
247
        if (n >= values.size()) {
496
0
            return static_cast<double>(*std::max_element(values.begin(), values.end()));
497
0
        }
498
247
        if (n < 1) {
499
0
            return static_cast<double>(*std::min_element(values.begin(), values.end()));
500
0
        }
501
502
247
        std::nth_element(values.begin(), values.begin() + n - 1, values.end());
503
247
        auto* nth_elem = std::min_element(values.begin() + n, values.end());
504
505
247
        return static_cast<double>(values[n - 1]) +
506
247
               (h - static_cast<double>(n)) *
507
247
                       (static_cast<double>(*nth_elem) - static_cast<double>(values[n - 1]));
508
247
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE3EE10_get_floatEd
Line
Count
Source
487
1
    double _get_float(double quantile) const {
488
1
        if (values.size() == 1) {
489
0
            return static_cast<double>(values.front());
490
0
        }
491
492
1
        double h = quantile * static_cast<double>(values.size() - 1) + 1;
493
1
        auto n = static_cast<size_t>(h);
494
495
1
        if (n >= values.size()) {
496
0
            return static_cast<double>(*std::max_element(values.begin(), values.end()));
497
0
        }
498
1
        if (n < 1) {
499
0
            return static_cast<double>(*std::min_element(values.begin(), values.end()));
500
0
        }
501
502
1
        std::nth_element(values.begin(), values.begin() + n - 1, values.end());
503
1
        auto* nth_elem = std::min_element(values.begin() + n, values.end());
504
505
1
        return static_cast<double>(values[n - 1]) +
506
1
               (h - static_cast<double>(n)) *
507
1
                       (static_cast<double>(*nth_elem) - static_cast<double>(values[n - 1]));
508
1
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE4EE10_get_floatEd
Line
Count
Source
487
177
    double _get_float(double quantile) const {
488
177
        if (values.size() == 1) {
489
42
            return static_cast<double>(values.front());
490
42
        }
491
492
135
        double h = quantile * static_cast<double>(values.size() - 1) + 1;
493
135
        auto n = static_cast<size_t>(h);
494
495
135
        if (n >= values.size()) {
496
0
            return static_cast<double>(*std::max_element(values.begin(), values.end()));
497
0
        }
498
135
        if (n < 1) {
499
0
            return static_cast<double>(*std::min_element(values.begin(), values.end()));
500
0
        }
501
502
135
        std::nth_element(values.begin(), values.begin() + n - 1, values.end());
503
135
        auto* nth_elem = std::min_element(values.begin() + n, values.end());
504
505
135
        return static_cast<double>(values[n - 1]) +
506
135
               (h - static_cast<double>(n)) *
507
135
                       (static_cast<double>(*nth_elem) - static_cast<double>(values[n - 1]));
508
135
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE5EE10_get_floatEd
Line
Count
Source
487
54
    double _get_float(double quantile) const {
488
54
        if (values.size() == 1) {
489
21
            return static_cast<double>(values.front());
490
21
        }
491
492
33
        double h = quantile * static_cast<double>(values.size() - 1) + 1;
493
33
        auto n = static_cast<size_t>(h);
494
495
33
        if (n >= values.size()) {
496
0
            return static_cast<double>(*std::max_element(values.begin(), values.end()));
497
0
        }
498
33
        if (n < 1) {
499
0
            return static_cast<double>(*std::min_element(values.begin(), values.end()));
500
0
        }
501
502
33
        std::nth_element(values.begin(), values.begin() + n - 1, values.end());
503
33
        auto* nth_elem = std::min_element(values.begin() + n, values.end());
504
505
33
        return static_cast<double>(values[n - 1]) +
506
33
               (h - static_cast<double>(n)) *
507
33
                       (static_cast<double>(*nth_elem) - static_cast<double>(values[n - 1]));
508
33
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE6EE10_get_floatEd
Line
Count
Source
487
90
    double _get_float(double quantile) const {
488
90
        if (values.size() == 1) {
489
35
            return static_cast<double>(values.front());
490
35
        }
491
492
55
        double h = quantile * static_cast<double>(values.size() - 1) + 1;
493
55
        auto n = static_cast<size_t>(h);
494
495
55
        if (n >= values.size()) {
496
0
            return static_cast<double>(*std::max_element(values.begin(), values.end()));
497
0
        }
498
55
        if (n < 1) {
499
0
            return static_cast<double>(*std::min_element(values.begin(), values.end()));
500
0
        }
501
502
55
        std::nth_element(values.begin(), values.begin() + n - 1, values.end());
503
55
        auto* nth_elem = std::min_element(values.begin() + n, values.end());
504
505
55
        return static_cast<double>(values[n - 1]) +
506
55
               (h - static_cast<double>(n)) *
507
55
                       (static_cast<double>(*nth_elem) - static_cast<double>(values[n - 1]));
508
55
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE7EE10_get_floatEd
Line
Count
Source
487
1
    double _get_float(double quantile) const {
488
1
        if (values.size() == 1) {
489
0
            return static_cast<double>(values.front());
490
0
        }
491
492
1
        double h = quantile * static_cast<double>(values.size() - 1) + 1;
493
1
        auto n = static_cast<size_t>(h);
494
495
1
        if (n >= values.size()) {
496
0
            return static_cast<double>(*std::max_element(values.begin(), values.end()));
497
0
        }
498
1
        if (n < 1) {
499
0
            return static_cast<double>(*std::min_element(values.begin(), values.end()));
500
0
        }
501
502
1
        std::nth_element(values.begin(), values.begin() + n - 1, values.end());
503
1
        auto* nth_elem = std::min_element(values.begin() + n, values.end());
504
505
1
        return static_cast<double>(values[n - 1]) +
506
1
               (h - static_cast<double>(n)) *
507
1
                       (static_cast<double>(*nth_elem) - static_cast<double>(values[n - 1]));
508
1
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE8EE10_get_floatEd
Line
Count
Source
487
1
    double _get_float(double quantile) const {
488
1
        if (values.size() == 1) {
489
0
            return static_cast<double>(values.front());
490
0
        }
491
492
1
        double h = quantile * static_cast<double>(values.size() - 1) + 1;
493
1
        auto n = static_cast<size_t>(h);
494
495
1
        if (n >= values.size()) {
496
0
            return static_cast<double>(*std::max_element(values.begin(), values.end()));
497
0
        }
498
1
        if (n < 1) {
499
0
            return static_cast<double>(*std::min_element(values.begin(), values.end()));
500
0
        }
501
502
1
        std::nth_element(values.begin(), values.begin() + n - 1, values.end());
503
1
        auto* nth_elem = std::min_element(values.begin() + n, values.end());
504
505
1
        return static_cast<double>(values[n - 1]) +
506
1
               (h - static_cast<double>(n)) *
507
1
                       (static_cast<double>(*nth_elem) - static_cast<double>(values[n - 1]));
508
1
    }
_ZNK5doris15PercentileStateILNS_13PrimitiveTypeE9EE10_get_floatEd
Line
Count
Source
487
33
    double _get_float(double quantile) const {
488
33
        if (values.size() == 1) {
489
12
            return static_cast<double>(values.front());
490
12
        }
491
492
21
        double h = quantile * static_cast<double>(values.size() - 1) + 1;
493
21
        auto n = static_cast<size_t>(h);
494
495
21
        if (n >= values.size()) {
496
0
            return static_cast<double>(*std::max_element(values.begin(), values.end()));
497
0
        }
498
21
        if (n < 1) {
499
0
            return static_cast<double>(*std::min_element(values.begin(), values.end()));
500
0
        }
501
502
21
        std::nth_element(values.begin(), values.begin() + n - 1, values.end());
503
21
        auto* nth_elem = std::min_element(values.begin() + n, values.end());
504
505
21
        return static_cast<double>(values[n - 1]) +
506
21
               (h - static_cast<double>(n)) *
507
21
                       (static_cast<double>(*nth_elem) - static_cast<double>(values[n - 1]));
508
21
    }
509
510
    mutable Array values;
511
    PercentileLevels levels;
512
    bool inited_flag = false;
513
};
514
515
template <PrimitiveType T>
516
class AggregateFunctionPercentile final
517
        : public IAggregateFunctionDataHelper<PercentileState<T>, AggregateFunctionPercentile<T>>,
518
          MultiExpression,
519
          NullableAggregateFunction {
520
public:
521
    using ColVecType = typename PrimitiveTypeTraits<T>::ColumnType;
522
    using Base = IAggregateFunctionDataHelper<PercentileState<T>, AggregateFunctionPercentile<T>>;
523
1.49k
    AggregateFunctionPercentile(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE3EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
523
4
    AggregateFunctionPercentile(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE4EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
523
14
    AggregateFunctionPercentile(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE5EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
523
28
    AggregateFunctionPercentile(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE6EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
523
1.42k
    AggregateFunctionPercentile(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE7EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
523
2
    AggregateFunctionPercentile(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE8EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
523
2
    AggregateFunctionPercentile(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE9EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
523
11
    AggregateFunctionPercentile(const DataTypes& argument_types_) : Base(argument_types_) {}
524
525
270
    String get_name() const override { return "percentile"; }
Unexecuted instantiation: _ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE3EE8get_nameB5cxx11Ev
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE4EE8get_nameB5cxx11Ev
Line
Count
Source
525
113
    String get_name() const override { return "percentile"; }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE5EE8get_nameB5cxx11Ev
Line
Count
Source
525
1
    String get_name() const override { return "percentile"; }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE6EE8get_nameB5cxx11Ev
Line
Count
Source
525
146
    String get_name() const override { return "percentile"; }
Unexecuted instantiation: _ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE7EE8get_nameB5cxx11Ev
Unexecuted instantiation: _ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE8EE8get_nameB5cxx11Ev
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE9EE8get_nameB5cxx11Ev
Line
Count
Source
525
10
    String get_name() const override { return "percentile"; }
526
527
321
    DataTypePtr get_return_type() const override { return std::make_shared<DataTypeFloat64>(); }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE3EE15get_return_typeEv
Line
Count
Source
527
8
    DataTypePtr get_return_type() const override { return std::make_shared<DataTypeFloat64>(); }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE4EE15get_return_typeEv
Line
Count
Source
527
128
    DataTypePtr get_return_type() const override { return std::make_shared<DataTypeFloat64>(); }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE5EE15get_return_typeEv
Line
Count
Source
527
53
    DataTypePtr get_return_type() const override { return std::make_shared<DataTypeFloat64>(); }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE6EE15get_return_typeEv
Line
Count
Source
527
93
    DataTypePtr get_return_type() const override { return std::make_shared<DataTypeFloat64>(); }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE7EE15get_return_typeEv
Line
Count
Source
527
4
    DataTypePtr get_return_type() const override { return std::make_shared<DataTypeFloat64>(); }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE8EE15get_return_typeEv
Line
Count
Source
527
4
    DataTypePtr get_return_type() const override { return std::make_shared<DataTypeFloat64>(); }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE9EE15get_return_typeEv
Line
Count
Source
527
31
    DataTypePtr get_return_type() const override { return std::make_shared<DataTypeFloat64>(); }
528
529
    void add(AggregateDataPtr __restrict place, const IColumn** columns, ssize_t row_num,
530
902
             Arena&) const override {
531
902
        const auto& sources =
532
902
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
533
902
        const auto& quantile =
534
902
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
535
902
        AggregateFunctionPercentile::data(place).add_single_range(&sources.get_data()[row_num], 1,
536
902
                                                                  quantile.get_data()[0]);
537
902
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE3EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
530
3
             Arena&) const override {
531
3
        const auto& sources =
532
3
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
533
3
        const auto& quantile =
534
3
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
535
3
        AggregateFunctionPercentile::data(place).add_single_range(&sources.get_data()[row_num], 1,
536
3
                                                                  quantile.get_data()[0]);
537
3
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE4EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
530
311
             Arena&) const override {
531
311
        const auto& sources =
532
311
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
533
311
        const auto& quantile =
534
311
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
535
311
        AggregateFunctionPercentile::data(place).add_single_range(&sources.get_data()[row_num], 1,
536
311
                                                                  quantile.get_data()[0]);
537
311
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE5EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
530
228
             Arena&) const override {
531
228
        const auto& sources =
532
228
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
533
228
        const auto& quantile =
534
228
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
535
228
        AggregateFunctionPercentile::data(place).add_single_range(&sources.get_data()[row_num], 1,
536
228
                                                                  quantile.get_data()[0]);
537
228
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE6EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
530
314
             Arena&) const override {
531
314
        const auto& sources =
532
314
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
533
314
        const auto& quantile =
534
314
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
535
314
        AggregateFunctionPercentile::data(place).add_single_range(&sources.get_data()[row_num], 1,
536
314
                                                                  quantile.get_data()[0]);
537
314
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE7EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
530
3
             Arena&) const override {
531
3
        const auto& sources =
532
3
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
533
3
        const auto& quantile =
534
3
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
535
3
        AggregateFunctionPercentile::data(place).add_single_range(&sources.get_data()[row_num], 1,
536
3
                                                                  quantile.get_data()[0]);
537
3
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE8EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
530
3
             Arena&) const override {
531
3
        const auto& sources =
532
3
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
533
3
        const auto& quantile =
534
3
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
535
3
        AggregateFunctionPercentile::data(place).add_single_range(&sources.get_data()[row_num], 1,
536
3
                                                                  quantile.get_data()[0]);
537
3
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE9EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
530
40
             Arena&) const override {
531
40
        const auto& sources =
532
40
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
533
40
        const auto& quantile =
534
40
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
535
40
        AggregateFunctionPercentile::data(place).add_single_range(&sources.get_data()[row_num], 1,
536
40
                                                                  quantile.get_data()[0]);
537
40
    }
538
539
    void add_batch_single_place(size_t batch_size, AggregateDataPtr place, const IColumn** columns,
540
7
                                Arena&) const override {
541
7
        const auto& sources =
542
7
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
543
7
        const auto& quantile =
544
7
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
545
7
        DCHECK_EQ(sources.get_data().size(), batch_size);
546
7
        AggregateFunctionPercentile::data(place).add_single_range(
547
7
                sources.get_data().data(), batch_size, quantile.get_data()[0]);
548
7
    }
Unexecuted instantiation: _ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE3EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
Unexecuted instantiation: _ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE4EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE5EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
Line
Count
Source
540
2
                                Arena&) const override {
541
2
        const auto& sources =
542
2
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
543
2
        const auto& quantile =
544
2
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
545
        DCHECK_EQ(sources.get_data().size(), batch_size);
546
2
        AggregateFunctionPercentile::data(place).add_single_range(
547
2
                sources.get_data().data(), batch_size, quantile.get_data()[0]);
548
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE6EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
Line
Count
Source
540
5
                                Arena&) const override {
541
5
        const auto& sources =
542
5
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
543
5
        const auto& quantile =
544
5
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
545
        DCHECK_EQ(sources.get_data().size(), batch_size);
546
5
        AggregateFunctionPercentile::data(place).add_single_range(
547
5
                sources.get_data().data(), batch_size, quantile.get_data()[0]);
548
5
    }
Unexecuted instantiation: _ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE7EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
Unexecuted instantiation: _ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE8EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
Unexecuted instantiation: _ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE9EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
549
550
    void add_batch_range(size_t batch_begin, size_t batch_end, AggregateDataPtr place,
551
0
                         const IColumn** columns, Arena&, bool has_null) override {
552
0
        const auto& sources =
553
0
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
554
0
        const auto& quantile =
555
0
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(*columns[1]);
556
0
        DCHECK(!has_null);
557
0
        AggregateFunctionPercentile::data(place).add_single_range(
558
0
                sources.get_data().data() + batch_begin, batch_end - batch_begin + 1,
559
0
                quantile.get_data()[0]);
560
0
    }
Unexecuted instantiation: _ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE3EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
Unexecuted instantiation: _ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE4EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
Unexecuted instantiation: _ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE5EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
Unexecuted instantiation: _ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE6EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
Unexecuted instantiation: _ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE7EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
Unexecuted instantiation: _ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE8EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
Unexecuted instantiation: _ZN5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE9EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
561
562
205
    void reset(AggregateDataPtr __restrict place) const override {
563
205
        AggregateFunctionPercentile::data(place).reset();
564
205
    }
Unexecuted instantiation: _ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE3EE5resetEPc
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE4EE5resetEPc
Line
Count
Source
562
102
    void reset(AggregateDataPtr __restrict place) const override {
563
102
        AggregateFunctionPercentile::data(place).reset();
564
102
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE5EE5resetEPc
Line
Count
Source
562
9
    void reset(AggregateDataPtr __restrict place) const override {
563
9
        AggregateFunctionPercentile::data(place).reset();
564
9
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE6EE5resetEPc
Line
Count
Source
562
91
    void reset(AggregateDataPtr __restrict place) const override {
563
91
        AggregateFunctionPercentile::data(place).reset();
564
91
    }
Unexecuted instantiation: _ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE7EE5resetEPc
Unexecuted instantiation: _ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE8EE5resetEPc
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE9EE5resetEPc
Line
Count
Source
562
3
    void reset(AggregateDataPtr __restrict place) const override {
563
3
        AggregateFunctionPercentile::data(place).reset();
564
3
    }
565
566
    void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs,
567
368
               Arena&) const override {
568
368
        AggregateFunctionPercentile::data(place).merge(AggregateFunctionPercentile::data(rhs));
569
368
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE3EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
567
2
               Arena&) const override {
568
2
        AggregateFunctionPercentile::data(place).merge(AggregateFunctionPercentile::data(rhs));
569
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE4EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
567
2
               Arena&) const override {
568
2
        AggregateFunctionPercentile::data(place).merge(AggregateFunctionPercentile::data(rhs));
569
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE5EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
567
37
               Arena&) const override {
568
37
        AggregateFunctionPercentile::data(place).merge(AggregateFunctionPercentile::data(rhs));
569
37
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE6EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
567
321
               Arena&) const override {
568
321
        AggregateFunctionPercentile::data(place).merge(AggregateFunctionPercentile::data(rhs));
569
321
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE7EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
567
2
               Arena&) const override {
568
2
        AggregateFunctionPercentile::data(place).merge(AggregateFunctionPercentile::data(rhs));
569
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE8EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
567
2
               Arena&) const override {
568
2
        AggregateFunctionPercentile::data(place).merge(AggregateFunctionPercentile::data(rhs));
569
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE9EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
567
2
               Arena&) const override {
568
2
        AggregateFunctionPercentile::data(place).merge(AggregateFunctionPercentile::data(rhs));
569
2
    }
570
571
383
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
572
383
        AggregateFunctionPercentile::data(place).write(buf);
573
383
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE3EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
571
2
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
572
2
        AggregateFunctionPercentile::data(place).write(buf);
573
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE4EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
571
2
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
572
2
        AggregateFunctionPercentile::data(place).write(buf);
573
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE5EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
571
37
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
572
37
        AggregateFunctionPercentile::data(place).write(buf);
573
37
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE6EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
571
336
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
572
336
        AggregateFunctionPercentile::data(place).write(buf);
573
336
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE7EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
571
2
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
572
2
        AggregateFunctionPercentile::data(place).write(buf);
573
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE8EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
571
2
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
572
2
        AggregateFunctionPercentile::data(place).write(buf);
573
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE9EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
571
2
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
572
2
        AggregateFunctionPercentile::data(place).write(buf);
573
2
    }
574
575
    void deserialize(AggregateDataPtr __restrict place, BufferReadable& buf,
576
368
                     Arena&) const override {
577
368
        AggregateFunctionPercentile::data(place).read(buf);
578
368
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE3EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
576
2
                     Arena&) const override {
577
2
        AggregateFunctionPercentile::data(place).read(buf);
578
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE4EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
576
2
                     Arena&) const override {
577
2
        AggregateFunctionPercentile::data(place).read(buf);
578
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE5EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
576
37
                     Arena&) const override {
577
37
        AggregateFunctionPercentile::data(place).read(buf);
578
37
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE6EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
576
321
                     Arena&) const override {
577
321
        AggregateFunctionPercentile::data(place).read(buf);
578
321
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE7EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
576
2
                     Arena&) const override {
577
2
        AggregateFunctionPercentile::data(place).read(buf);
578
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE8EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
576
2
                     Arena&) const override {
577
2
        AggregateFunctionPercentile::data(place).read(buf);
578
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE9EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
576
2
                     Arena&) const override {
577
2
        AggregateFunctionPercentile::data(place).read(buf);
578
2
    }
579
580
359
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
581
359
        auto& col = assert_cast<ColumnFloat64&>(to);
582
359
        col.insert_value(AggregateFunctionPercentile::data(place).get());
583
359
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE3EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
580
2
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
581
2
        auto& col = assert_cast<ColumnFloat64&>(to);
582
2
        col.insert_value(AggregateFunctionPercentile::data(place).get());
583
2
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE4EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
580
177
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
581
177
        auto& col = assert_cast<ColumnFloat64&>(to);
582
177
        col.insert_value(AggregateFunctionPercentile::data(place).get());
583
177
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE5EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
580
54
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
581
54
        auto& col = assert_cast<ColumnFloat64&>(to);
582
54
        col.insert_value(AggregateFunctionPercentile::data(place).get());
583
54
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE6EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
580
91
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
581
91
        auto& col = assert_cast<ColumnFloat64&>(to);
582
91
        col.insert_value(AggregateFunctionPercentile::data(place).get());
583
91
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE7EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
580
1
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
581
1
        auto& col = assert_cast<ColumnFloat64&>(to);
582
1
        col.insert_value(AggregateFunctionPercentile::data(place).get());
583
1
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE8EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
580
1
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
581
1
        auto& col = assert_cast<ColumnFloat64&>(to);
582
1
        col.insert_value(AggregateFunctionPercentile::data(place).get());
583
1
    }
_ZNK5doris27AggregateFunctionPercentileILNS_13PrimitiveTypeE9EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
580
33
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
581
33
        auto& col = assert_cast<ColumnFloat64&>(to);
582
33
        col.insert_value(AggregateFunctionPercentile::data(place).get());
583
33
    }
584
};
585
586
template <PrimitiveType T>
587
class AggregateFunctionPercentileArray final
588
        : public IAggregateFunctionDataHelper<PercentileState<T>,
589
                                              AggregateFunctionPercentileArray<T>>,
590
          MultiExpression,
591
          NotNullableAggregateFunction {
592
public:
593
    using ColVecType = typename PrimitiveTypeTraits<T>::ColumnType;
594
    using ValueType = typename PrimitiveTypeTraits<T>::CppType;
595
    using Base =
596
            IAggregateFunctionDataHelper<PercentileState<T>, AggregateFunctionPercentileArray<T>>;
597
376
    AggregateFunctionPercentileArray(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE3EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
597
4
    AggregateFunctionPercentileArray(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE4EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
597
4
    AggregateFunctionPercentileArray(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE5EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
597
343
    AggregateFunctionPercentileArray(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE6EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
597
10
    AggregateFunctionPercentileArray(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE7EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
597
2
    AggregateFunctionPercentileArray(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE8EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
597
2
    AggregateFunctionPercentileArray(const DataTypes& argument_types_) : Base(argument_types_) {}
_ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE9EEC2ERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE
Line
Count
Source
597
11
    AggregateFunctionPercentileArray(const DataTypes& argument_types_) : Base(argument_types_) {}
598
599
29
    String get_name() const override { return "percentile_array"; }
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE3EE8get_nameB5cxx11Ev
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE4EE8get_nameB5cxx11Ev
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE5EE8get_nameB5cxx11Ev
Line
Count
Source
599
19
    String get_name() const override { return "percentile_array"; }
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE6EE8get_nameB5cxx11Ev
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE7EE8get_nameB5cxx11Ev
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE8EE8get_nameB5cxx11Ev
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE9EE8get_nameB5cxx11Ev
Line
Count
Source
599
10
    String get_name() const override { return "percentile_array"; }
600
601
146
    DataTypePtr get_return_type() const override {
602
146
        return std::make_shared<DataTypeArray>(make_nullable(std::make_shared<DataTypeFloat64>()));
603
146
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE3EE15get_return_typeEv
Line
Count
Source
601
8
    DataTypePtr get_return_type() const override {
602
8
        return std::make_shared<DataTypeArray>(make_nullable(std::make_shared<DataTypeFloat64>()));
603
8
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE4EE15get_return_typeEv
Line
Count
Source
601
8
    DataTypePtr get_return_type() const override {
602
8
        return std::make_shared<DataTypeArray>(make_nullable(std::make_shared<DataTypeFloat64>()));
603
8
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE5EE15get_return_typeEv
Line
Count
Source
601
77
    DataTypePtr get_return_type() const override {
602
77
        return std::make_shared<DataTypeArray>(make_nullable(std::make_shared<DataTypeFloat64>()));
603
77
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE6EE15get_return_typeEv
Line
Count
Source
601
17
    DataTypePtr get_return_type() const override {
602
17
        return std::make_shared<DataTypeArray>(make_nullable(std::make_shared<DataTypeFloat64>()));
603
17
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE7EE15get_return_typeEv
Line
Count
Source
601
4
    DataTypePtr get_return_type() const override {
602
4
        return std::make_shared<DataTypeArray>(make_nullable(std::make_shared<DataTypeFloat64>()));
603
4
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE8EE15get_return_typeEv
Line
Count
Source
601
4
    DataTypePtr get_return_type() const override {
602
4
        return std::make_shared<DataTypeArray>(make_nullable(std::make_shared<DataTypeFloat64>()));
603
4
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE9EE15get_return_typeEv
Line
Count
Source
601
28
    DataTypePtr get_return_type() const override {
602
28
        return std::make_shared<DataTypeArray>(make_nullable(std::make_shared<DataTypeFloat64>()));
603
28
    }
604
605
    void add(AggregateDataPtr __restrict place, const IColumn** columns, ssize_t row_num,
606
710
             Arena&) const override {
607
710
        const auto& sources =
608
710
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
609
710
        const auto& quantile_array =
610
710
                assert_cast<const ColumnArray&, TypeCheckOnRelease::DISABLE>(*columns[1]);
611
710
        const auto& offset_column_data = quantile_array.get_offsets();
612
710
        const auto& null_maps = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
613
710
                                        quantile_array.get_data())
614
710
                                        .get_null_map_data();
615
710
        const auto& nested_column = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
616
710
                                            quantile_array.get_data())
617
710
                                            .get_nested_column();
618
710
        const auto& nested_column_data =
619
710
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(nested_column);
620
710
        size_t start = row_num == 0 ? 0 : offset_column_data[row_num - 1];
621
710
        AggregateFunctionPercentileArray::data(place).add_many_range(
622
710
                &sources.get_data()[row_num], 1, nested_column_data.get_data(), null_maps, start,
623
710
                cast_set<int64_t>(offset_column_data[row_num] - start));
624
710
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE3EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
606
15
             Arena&) const override {
607
15
        const auto& sources =
608
15
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
609
15
        const auto& quantile_array =
610
15
                assert_cast<const ColumnArray&, TypeCheckOnRelease::DISABLE>(*columns[1]);
611
15
        const auto& offset_column_data = quantile_array.get_offsets();
612
15
        const auto& null_maps = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
613
15
                                        quantile_array.get_data())
614
15
                                        .get_null_map_data();
615
15
        const auto& nested_column = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
616
15
                                            quantile_array.get_data())
617
15
                                            .get_nested_column();
618
15
        const auto& nested_column_data =
619
15
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(nested_column);
620
15
        size_t start = row_num == 0 ? 0 : offset_column_data[row_num - 1];
621
15
        AggregateFunctionPercentileArray::data(place).add_many_range(
622
15
                &sources.get_data()[row_num], 1, nested_column_data.get_data(), null_maps, start,
623
15
                cast_set<int64_t>(offset_column_data[row_num] - start));
624
15
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE4EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
606
18
             Arena&) const override {
607
18
        const auto& sources =
608
18
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
609
18
        const auto& quantile_array =
610
18
                assert_cast<const ColumnArray&, TypeCheckOnRelease::DISABLE>(*columns[1]);
611
18
        const auto& offset_column_data = quantile_array.get_offsets();
612
18
        const auto& null_maps = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
613
18
                                        quantile_array.get_data())
614
18
                                        .get_null_map_data();
615
18
        const auto& nested_column = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
616
18
                                            quantile_array.get_data())
617
18
                                            .get_nested_column();
618
18
        const auto& nested_column_data =
619
18
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(nested_column);
620
18
        size_t start = row_num == 0 ? 0 : offset_column_data[row_num - 1];
621
18
        AggregateFunctionPercentileArray::data(place).add_many_range(
622
18
                &sources.get_data()[row_num], 1, nested_column_data.get_data(), null_maps, start,
623
18
                cast_set<int64_t>(offset_column_data[row_num] - start));
624
18
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE5EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
606
572
             Arena&) const override {
607
572
        const auto& sources =
608
572
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
609
572
        const auto& quantile_array =
610
572
                assert_cast<const ColumnArray&, TypeCheckOnRelease::DISABLE>(*columns[1]);
611
572
        const auto& offset_column_data = quantile_array.get_offsets();
612
572
        const auto& null_maps = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
613
572
                                        quantile_array.get_data())
614
572
                                        .get_null_map_data();
615
572
        const auto& nested_column = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
616
572
                                            quantile_array.get_data())
617
572
                                            .get_nested_column();
618
572
        const auto& nested_column_data =
619
572
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(nested_column);
620
572
        size_t start = row_num == 0 ? 0 : offset_column_data[row_num - 1];
621
572
        AggregateFunctionPercentileArray::data(place).add_many_range(
622
572
                &sources.get_data()[row_num], 1, nested_column_data.get_data(), null_maps, start,
623
572
                cast_set<int64_t>(offset_column_data[row_num] - start));
624
572
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE6EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
606
21
             Arena&) const override {
607
21
        const auto& sources =
608
21
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
609
21
        const auto& quantile_array =
610
21
                assert_cast<const ColumnArray&, TypeCheckOnRelease::DISABLE>(*columns[1]);
611
21
        const auto& offset_column_data = quantile_array.get_offsets();
612
21
        const auto& null_maps = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
613
21
                                        quantile_array.get_data())
614
21
                                        .get_null_map_data();
615
21
        const auto& nested_column = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
616
21
                                            quantile_array.get_data())
617
21
                                            .get_nested_column();
618
21
        const auto& nested_column_data =
619
21
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(nested_column);
620
21
        size_t start = row_num == 0 ? 0 : offset_column_data[row_num - 1];
621
21
        AggregateFunctionPercentileArray::data(place).add_many_range(
622
21
                &sources.get_data()[row_num], 1, nested_column_data.get_data(), null_maps, start,
623
21
                cast_set<int64_t>(offset_column_data[row_num] - start));
624
21
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE7EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
606
3
             Arena&) const override {
607
3
        const auto& sources =
608
3
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
609
3
        const auto& quantile_array =
610
3
                assert_cast<const ColumnArray&, TypeCheckOnRelease::DISABLE>(*columns[1]);
611
3
        const auto& offset_column_data = quantile_array.get_offsets();
612
3
        const auto& null_maps = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
613
3
                                        quantile_array.get_data())
614
3
                                        .get_null_map_data();
615
3
        const auto& nested_column = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
616
3
                                            quantile_array.get_data())
617
3
                                            .get_nested_column();
618
3
        const auto& nested_column_data =
619
3
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(nested_column);
620
3
        size_t start = row_num == 0 ? 0 : offset_column_data[row_num - 1];
621
3
        AggregateFunctionPercentileArray::data(place).add_many_range(
622
3
                &sources.get_data()[row_num], 1, nested_column_data.get_data(), null_maps, start,
623
3
                cast_set<int64_t>(offset_column_data[row_num] - start));
624
3
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE8EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
606
3
             Arena&) const override {
607
3
        const auto& sources =
608
3
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
609
3
        const auto& quantile_array =
610
3
                assert_cast<const ColumnArray&, TypeCheckOnRelease::DISABLE>(*columns[1]);
611
3
        const auto& offset_column_data = quantile_array.get_offsets();
612
3
        const auto& null_maps = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
613
3
                                        quantile_array.get_data())
614
3
                                        .get_null_map_data();
615
3
        const auto& nested_column = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
616
3
                                            quantile_array.get_data())
617
3
                                            .get_nested_column();
618
3
        const auto& nested_column_data =
619
3
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(nested_column);
620
3
        size_t start = row_num == 0 ? 0 : offset_column_data[row_num - 1];
621
3
        AggregateFunctionPercentileArray::data(place).add_many_range(
622
3
                &sources.get_data()[row_num], 1, nested_column_data.get_data(), null_maps, start,
623
3
                cast_set<int64_t>(offset_column_data[row_num] - start));
624
3
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE9EE3addEPcPPKNS_7IColumnElRNS_5ArenaE
Line
Count
Source
606
78
             Arena&) const override {
607
78
        const auto& sources =
608
78
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
609
78
        const auto& quantile_array =
610
78
                assert_cast<const ColumnArray&, TypeCheckOnRelease::DISABLE>(*columns[1]);
611
78
        const auto& offset_column_data = quantile_array.get_offsets();
612
78
        const auto& null_maps = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
613
78
                                        quantile_array.get_data())
614
78
                                        .get_null_map_data();
615
78
        const auto& nested_column = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
616
78
                                            quantile_array.get_data())
617
78
                                            .get_nested_column();
618
78
        const auto& nested_column_data =
619
78
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(nested_column);
620
78
        size_t start = row_num == 0 ? 0 : offset_column_data[row_num - 1];
621
78
        AggregateFunctionPercentileArray::data(place).add_many_range(
622
78
                &sources.get_data()[row_num], 1, nested_column_data.get_data(), null_maps, start,
623
78
                cast_set<int64_t>(offset_column_data[row_num] - start));
624
78
    }
625
626
    void add_batch_single_place(size_t batch_size, AggregateDataPtr place, const IColumn** columns,
627
1
                                Arena&) const override {
628
1
        const auto& sources =
629
1
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
630
1
        const auto& quantile_array =
631
1
                assert_cast<const ColumnArray&, TypeCheckOnRelease::DISABLE>(*columns[1]);
632
1
        const auto& offset_column_data = quantile_array.get_offsets();
633
1
        const auto& null_maps = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
634
1
                                        quantile_array.get_data())
635
1
                                        .get_null_map_data();
636
1
        const auto& nested_column = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
637
1
                                            quantile_array.get_data())
638
1
                                            .get_nested_column();
639
1
        const auto& nested_column_data =
640
1
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(nested_column);
641
1
        DCHECK_EQ(sources.get_data().size(), batch_size);
642
1
        AggregateFunctionPercentileArray::data(place).add_many_range(
643
1
                sources.get_data().data(), batch_size, nested_column_data.get_data(), null_maps, 0,
644
1
                cast_set<int64_t>(offset_column_data[0]));
645
1
    }
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE3EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE4EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE5EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
Line
Count
Source
627
1
                                Arena&) const override {
628
1
        const auto& sources =
629
1
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
630
1
        const auto& quantile_array =
631
1
                assert_cast<const ColumnArray&, TypeCheckOnRelease::DISABLE>(*columns[1]);
632
1
        const auto& offset_column_data = quantile_array.get_offsets();
633
1
        const auto& null_maps = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
634
1
                                        quantile_array.get_data())
635
1
                                        .get_null_map_data();
636
1
        const auto& nested_column = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
637
1
                                            quantile_array.get_data())
638
1
                                            .get_nested_column();
639
1
        const auto& nested_column_data =
640
1
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(nested_column);
641
        DCHECK_EQ(sources.get_data().size(), batch_size);
642
1
        AggregateFunctionPercentileArray::data(place).add_many_range(
643
1
                sources.get_data().data(), batch_size, nested_column_data.get_data(), null_maps, 0,
644
1
                cast_set<int64_t>(offset_column_data[0]));
645
1
    }
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE6EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE7EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE8EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE9EE22add_batch_single_placeEmPcPPKNS_7IColumnERNS_5ArenaE
646
647
    void add_batch_range(size_t batch_begin, size_t batch_end, AggregateDataPtr place,
648
0
                         const IColumn** columns, Arena&, bool has_null) override {
649
0
        const auto& sources =
650
0
                assert_cast<const ColVecType&, TypeCheckOnRelease::DISABLE>(*columns[0]);
651
0
        const auto& quantile_array =
652
0
                assert_cast<const ColumnArray&, TypeCheckOnRelease::DISABLE>(*columns[1]);
653
0
        const auto& offset_column_data = quantile_array.get_offsets();
654
0
        const auto& null_maps = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
655
0
                                        quantile_array.get_data())
656
0
                                        .get_null_map_data();
657
0
        const auto& nested_column = assert_cast<const ColumnNullable&, TypeCheckOnRelease::DISABLE>(
658
0
                                            quantile_array.get_data())
659
0
                                            .get_nested_column();
660
0
        const auto& nested_column_data =
661
0
                assert_cast<const ColumnFloat64&, TypeCheckOnRelease::DISABLE>(nested_column);
662
0
        DCHECK(!has_null);
663
0
        size_t start = batch_begin == 0 ? 0 : offset_column_data[batch_begin - 1];
664
0
        AggregateFunctionPercentileArray::data(place).add_many_range(
665
0
                sources.get_data().data() + batch_begin, batch_end - batch_begin + 1,
666
0
                nested_column_data.get_data(), null_maps, start,
667
0
                cast_set<int64_t>(offset_column_data[batch_begin] - start));
668
0
    }
Unexecuted instantiation: _ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE3EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
Unexecuted instantiation: _ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE4EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
Unexecuted instantiation: _ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE5EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
Unexecuted instantiation: _ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE6EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
Unexecuted instantiation: _ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE7EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
Unexecuted instantiation: _ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE8EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
Unexecuted instantiation: _ZN5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE9EE15add_batch_rangeEmmPcPPKNS_7IColumnERNS_5ArenaEb
669
670
29
    void reset(AggregateDataPtr __restrict place) const override {
671
29
        AggregateFunctionPercentileArray::data(place).reset();
672
29
    }
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE3EE5resetEPc
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE4EE5resetEPc
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE5EE5resetEPc
Line
Count
Source
670
26
    void reset(AggregateDataPtr __restrict place) const override {
671
26
        AggregateFunctionPercentileArray::data(place).reset();
672
26
    }
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE6EE5resetEPc
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE7EE5resetEPc
Unexecuted instantiation: _ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE8EE5resetEPc
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE9EE5resetEPc
Line
Count
Source
670
3
    void reset(AggregateDataPtr __restrict place) const override {
671
3
        AggregateFunctionPercentileArray::data(place).reset();
672
3
    }
673
674
    void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs,
675
363
               Arena&) const override {
676
363
        AggregateFunctionPercentileArray::data(place).merge(
677
363
                AggregateFunctionPercentileArray::data(rhs));
678
363
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE3EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
675
2
               Arena&) const override {
676
2
        AggregateFunctionPercentileArray::data(place).merge(
677
2
                AggregateFunctionPercentileArray::data(rhs));
678
2
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE4EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
675
4
               Arena&) const override {
676
4
        AggregateFunctionPercentileArray::data(place).merge(
677
4
                AggregateFunctionPercentileArray::data(rhs));
678
4
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE5EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
675
314
               Arena&) const override {
676
314
        AggregateFunctionPercentileArray::data(place).merge(
677
314
                AggregateFunctionPercentileArray::data(rhs));
678
314
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE6EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
675
3
               Arena&) const override {
676
3
        AggregateFunctionPercentileArray::data(place).merge(
677
3
                AggregateFunctionPercentileArray::data(rhs));
678
3
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE7EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
675
2
               Arena&) const override {
676
2
        AggregateFunctionPercentileArray::data(place).merge(
677
2
                AggregateFunctionPercentileArray::data(rhs));
678
2
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE8EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
675
2
               Arena&) const override {
676
2
        AggregateFunctionPercentileArray::data(place).merge(
677
2
                AggregateFunctionPercentileArray::data(rhs));
678
2
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE9EE5mergeEPcPKcRNS_5ArenaE
Line
Count
Source
675
36
               Arena&) const override {
676
36
        AggregateFunctionPercentileArray::data(place).merge(
677
36
                AggregateFunctionPercentileArray::data(rhs));
678
36
    }
679
680
403
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
681
403
        AggregateFunctionPercentileArray::data(place).write(buf);
682
403
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE3EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
680
2
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
681
2
        AggregateFunctionPercentileArray::data(place).write(buf);
682
2
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE4EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
680
4
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
681
4
        AggregateFunctionPercentileArray::data(place).write(buf);
682
4
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE5EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
680
354
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
681
354
        AggregateFunctionPercentileArray::data(place).write(buf);
682
354
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE6EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
680
3
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
681
3
        AggregateFunctionPercentileArray::data(place).write(buf);
682
3
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE7EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
680
2
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
681
2
        AggregateFunctionPercentileArray::data(place).write(buf);
682
2
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE8EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
680
2
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
681
2
        AggregateFunctionPercentileArray::data(place).write(buf);
682
2
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE9EE9serializeEPKcRNS_14BufferWritableE
Line
Count
Source
680
36
    void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& buf) const override {
681
36
        AggregateFunctionPercentileArray::data(place).write(buf);
682
36
    }
683
684
    void deserialize(AggregateDataPtr __restrict place, BufferReadable& buf,
685
365
                     Arena&) const override {
686
365
        AggregateFunctionPercentileArray::data(place).read(buf);
687
365
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE3EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
685
2
                     Arena&) const override {
686
2
        AggregateFunctionPercentileArray::data(place).read(buf);
687
2
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE4EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
685
4
                     Arena&) const override {
686
4
        AggregateFunctionPercentileArray::data(place).read(buf);
687
4
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE5EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
685
316
                     Arena&) const override {
686
316
        AggregateFunctionPercentileArray::data(place).read(buf);
687
316
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE6EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
685
3
                     Arena&) const override {
686
3
        AggregateFunctionPercentileArray::data(place).read(buf);
687
3
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE7EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
685
2
                     Arena&) const override {
686
2
        AggregateFunctionPercentileArray::data(place).read(buf);
687
2
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE8EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
685
2
                     Arena&) const override {
686
2
        AggregateFunctionPercentileArray::data(place).read(buf);
687
2
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE9EE11deserializeEPcRNS_14BufferReadableERNS_5ArenaE
Line
Count
Source
685
36
                     Arena&) const override {
686
36
        AggregateFunctionPercentileArray::data(place).read(buf);
687
36
    }
688
689
217
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
690
217
        auto& to_arr = assert_cast<ColumnArray&>(to);
691
217
        auto& to_nested_col = to_arr.get_data();
692
217
        if (to_nested_col.is_nullable()) {
693
217
            auto col_null = reinterpret_cast<ColumnNullable*>(&to_nested_col);
694
217
            AggregateFunctionPercentileArray::data(place).insert_result_into(
695
217
                    col_null->get_nested_column());
696
217
            col_null->get_null_map_data().resize_fill(col_null->get_nested_column().size(), 0);
697
217
        } else {
698
0
            AggregateFunctionPercentileArray::data(place).insert_result_into(to_nested_col);
699
0
        }
700
217
        to_arr.get_offsets().push_back(to_nested_col.size());
701
217
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE3EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
689
11
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
690
11
        auto& to_arr = assert_cast<ColumnArray&>(to);
691
11
        auto& to_nested_col = to_arr.get_data();
692
11
        if (to_nested_col.is_nullable()) {
693
11
            auto col_null = reinterpret_cast<ColumnNullable*>(&to_nested_col);
694
11
            AggregateFunctionPercentileArray::data(place).insert_result_into(
695
11
                    col_null->get_nested_column());
696
11
            col_null->get_null_map_data().resize_fill(col_null->get_nested_column().size(), 0);
697
11
        } else {
698
0
            AggregateFunctionPercentileArray::data(place).insert_result_into(to_nested_col);
699
0
        }
700
11
        to_arr.get_offsets().push_back(to_nested_col.size());
701
11
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE4EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
689
2
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
690
2
        auto& to_arr = assert_cast<ColumnArray&>(to);
691
2
        auto& to_nested_col = to_arr.get_data();
692
2
        if (to_nested_col.is_nullable()) {
693
2
            auto col_null = reinterpret_cast<ColumnNullable*>(&to_nested_col);
694
2
            AggregateFunctionPercentileArray::data(place).insert_result_into(
695
2
                    col_null->get_nested_column());
696
2
            col_null->get_null_map_data().resize_fill(col_null->get_nested_column().size(), 0);
697
2
        } else {
698
0
            AggregateFunctionPercentileArray::data(place).insert_result_into(to_nested_col);
699
0
        }
700
2
        to_arr.get_offsets().push_back(to_nested_col.size());
701
2
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE5EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
689
160
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
690
160
        auto& to_arr = assert_cast<ColumnArray&>(to);
691
160
        auto& to_nested_col = to_arr.get_data();
692
160
        if (to_nested_col.is_nullable()) {
693
160
            auto col_null = reinterpret_cast<ColumnNullable*>(&to_nested_col);
694
160
            AggregateFunctionPercentileArray::data(place).insert_result_into(
695
160
                    col_null->get_nested_column());
696
160
            col_null->get_null_map_data().resize_fill(col_null->get_nested_column().size(), 0);
697
160
        } else {
698
0
            AggregateFunctionPercentileArray::data(place).insert_result_into(to_nested_col);
699
0
        }
700
160
        to_arr.get_offsets().push_back(to_nested_col.size());
701
160
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE6EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
689
2
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
690
2
        auto& to_arr = assert_cast<ColumnArray&>(to);
691
2
        auto& to_nested_col = to_arr.get_data();
692
2
        if (to_nested_col.is_nullable()) {
693
2
            auto col_null = reinterpret_cast<ColumnNullable*>(&to_nested_col);
694
2
            AggregateFunctionPercentileArray::data(place).insert_result_into(
695
2
                    col_null->get_nested_column());
696
2
            col_null->get_null_map_data().resize_fill(col_null->get_nested_column().size(), 0);
697
2
        } else {
698
0
            AggregateFunctionPercentileArray::data(place).insert_result_into(to_nested_col);
699
0
        }
700
2
        to_arr.get_offsets().push_back(to_nested_col.size());
701
2
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE7EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
689
1
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
690
1
        auto& to_arr = assert_cast<ColumnArray&>(to);
691
1
        auto& to_nested_col = to_arr.get_data();
692
1
        if (to_nested_col.is_nullable()) {
693
1
            auto col_null = reinterpret_cast<ColumnNullable*>(&to_nested_col);
694
1
            AggregateFunctionPercentileArray::data(place).insert_result_into(
695
1
                    col_null->get_nested_column());
696
1
            col_null->get_null_map_data().resize_fill(col_null->get_nested_column().size(), 0);
697
1
        } else {
698
0
            AggregateFunctionPercentileArray::data(place).insert_result_into(to_nested_col);
699
0
        }
700
1
        to_arr.get_offsets().push_back(to_nested_col.size());
701
1
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE8EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
689
1
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
690
1
        auto& to_arr = assert_cast<ColumnArray&>(to);
691
1
        auto& to_nested_col = to_arr.get_data();
692
1
        if (to_nested_col.is_nullable()) {
693
1
            auto col_null = reinterpret_cast<ColumnNullable*>(&to_nested_col);
694
1
            AggregateFunctionPercentileArray::data(place).insert_result_into(
695
1
                    col_null->get_nested_column());
696
1
            col_null->get_null_map_data().resize_fill(col_null->get_nested_column().size(), 0);
697
1
        } else {
698
0
            AggregateFunctionPercentileArray::data(place).insert_result_into(to_nested_col);
699
0
        }
700
1
        to_arr.get_offsets().push_back(to_nested_col.size());
701
1
    }
_ZNK5doris32AggregateFunctionPercentileArrayILNS_13PrimitiveTypeE9EE18insert_result_intoEPKcRNS_7IColumnE
Line
Count
Source
689
40
    void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& to) const override {
690
40
        auto& to_arr = assert_cast<ColumnArray&>(to);
691
40
        auto& to_nested_col = to_arr.get_data();
692
40
        if (to_nested_col.is_nullable()) {
693
40
            auto col_null = reinterpret_cast<ColumnNullable*>(&to_nested_col);
694
40
            AggregateFunctionPercentileArray::data(place).insert_result_into(
695
40
                    col_null->get_nested_column());
696
40
            col_null->get_null_map_data().resize_fill(col_null->get_nested_column().size(), 0);
697
40
        } else {
698
0
            AggregateFunctionPercentileArray::data(place).insert_result_into(to_nested_col);
699
0
        }
700
40
        to_arr.get_offsets().push_back(to_nested_col.size());
701
40
    }
702
};
703
704
} // namespace doris