Coverage Report

Created: 2025-09-29 18:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/doris/be/src/vec/functions/function.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
// This file is copied from
18
// https://github.com/ClickHouse/ClickHouse/blob/master/src/Functions/IFunction.h
19
// and modified by Doris
20
21
#pragma once
22
23
#include <fmt/format.h>
24
#include <glog/logging.h>
25
26
#include <cstddef>
27
#include <memory>
28
#include <string>
29
#include <utility>
30
31
#include "common/exception.h"
32
#include "common/logging.h"
33
#include "common/status.h"
34
#include "olap/rowset/segment_v2/inverted_index_iterator.h" // IWYU pragma: keep
35
#include "udf/udf.h"
36
#include "vec/core/block.h"
37
#include "vec/core/column_numbers.h"
38
#include "vec/core/column_with_type_and_name.h"
39
#include "vec/core/columns_with_type_and_name.h"
40
#include "vec/core/types.h"
41
#include "vec/data_types/data_type.h"
42
#include "vec/data_types/data_type_nullable.h"
43
44
namespace doris::vectorized {
45
46
struct FunctionAttr {
47
    bool enable_decimal256 {false};
48
    bool new_version_unix_timestamp {false};
49
};
50
51
#define RETURN_REAL_TYPE_FOR_DATEV2_FUNCTION(TYPE)                                             \
52
31
    bool is_nullable = false;                                                                  \
53
31
    bool is_datev2 = false;                                                                    \
54
53
    for (auto it : arguments) {                                                                \
55
53
        is_nullable = is_nullable || it.type->is_nullable();                                   \
56
53
        is_datev2 = is_datev2 || it.type->get_primitive_type() == TYPE_DATEV2 ||               \
57
53
                    it.type->get_primitive_type() == TYPE_DATETIMEV2;                          \
58
53
    }                                                                                          \
59
31
    return is_nullable || !is_datev2                                                           \
60
31
                   ? make_nullable(                                                            \
61
26
                             std::make_shared<typename PrimitiveTypeTraits<TYPE>::DataType>()) \
62
31
                   : std::make_shared<typename PrimitiveTypeTraits<TYPE>::DataType>();
63
64
#define SET_NULLMAP_IF_FALSE(EXPR) \
65
    if (!EXPR) [[unlikely]] {      \
66
        null_map[i] = true;        \
67
    }
68
69
class Field;
70
class VExpr;
71
72
// Only use dispose the variadic argument
73
template <typename T>
74
auto has_variadic_argument_types(T&& arg) -> decltype(T::get_variadic_argument_types()) {};
75
void has_variadic_argument_types(...);
76
77
template <typename T>
78
concept HasGetVariadicArgumentTypesImpl = requires(T t) {
79
    { t.get_variadic_argument_types_impl() } -> std::same_as<DataTypes>;
80
};
81
82
bool have_null_column(const Block& block, const ColumnNumbers& args);
83
bool have_null_column(const ColumnsWithTypeAndName& args);
84
85
/// The simplest executable object.
86
/// Motivation:
87
///  * Prepare something heavy once before main execution loop instead of doing it for each block.
88
///  * Provide const interface for IFunctionBase (later).
89
class IPreparedFunction {
90
public:
91
100k
    virtual ~IPreparedFunction() = default;
92
93
    /// Get the main function name.
94
    virtual String get_name() const = 0;
95
96
    virtual Status execute(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
97
                           uint32_t result, size_t input_rows_count, bool dry_run) const = 0;
98
};
99
100
using PreparedFunctionPtr = std::shared_ptr<IPreparedFunction>;
101
102
class PreparedFunctionImpl : public IPreparedFunction {
103
public:
104
    Status execute(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
105
                   uint32_t result, size_t input_rows_count, bool dry_run = false) const final;
106
107
    /** If the function have non-zero number of arguments,
108
      *  and if all arguments are constant, that we could automatically provide default implementation:
109
      *  arguments are converted to ordinary columns with single value which is not const, then function is executed as usual,
110
      *  and then the result is converted to constant column.
111
      */
112
105k
    virtual bool use_default_implementation_for_constants() const { return true; }
113
114
    /** If use_default_implementation_for_nulls() is true, after execute the function,
115
      * whether need to replace the nested data of null data to the default value.
116
      * E.g. for binary arithmetic exprs, need return true to avoid false overflow.
117
      */
118
0
    virtual bool need_replace_null_data_to_default() const { return false; }
119
120
protected:
121
    virtual Status execute_impl_dry_run(FunctionContext* context, Block& block,
122
                                        const ColumnNumbers& arguments, uint32_t result,
123
0
                                        size_t input_rows_count) const {
124
0
        return execute_impl(context, block, arguments, result, input_rows_count);
125
0
    }
126
127
    virtual Status execute_impl(FunctionContext* context, Block& block,
128
                                const ColumnNumbers& arguments, uint32_t result,
129
                                size_t input_rows_count) const = 0;
130
131
    /** Default implementation in presence of Nullable arguments or NULL constants as arguments is the following:
132
      *  if some of arguments are NULL constants then return NULL constant,
133
      *  if some of arguments are Nullable, then execute function as usual for block,
134
      *   where Nullable columns are substituted with nested columns (they have arbitrary values in rows corresponding to NULL value)
135
      *   and wrap result in Nullable column where NULLs are in all rows where any of arguments are NULL.
136
      */
137
0
    virtual bool use_default_implementation_for_nulls() const { return true; }
138
139
0
    virtual bool skip_return_type_check() const { return false; }
140
141
    /** Some arguments could remain constant during this implementation.
142
      * Every argument required const must write here and no checks elsewhere.
143
      */
144
0
    virtual ColumnNumbers get_arguments_that_are_always_constant() const { return {}; }
145
146
private:
147
    Status default_implementation_for_nulls(FunctionContext* context, Block& block,
148
                                            const ColumnNumbers& args, uint32_t result,
149
                                            size_t input_rows_count, bool dry_run,
150
                                            bool* executed) const;
151
    Status default_implementation_for_constant_arguments(FunctionContext* context, Block& block,
152
                                                         const ColumnNumbers& args, uint32_t result,
153
                                                         size_t input_rows_count, bool dry_run,
154
                                                         bool* executed) const;
155
    Status execute_without_low_cardinality_columns(FunctionContext* context, Block& block,
156
                                                   const ColumnNumbers& arguments, uint32_t result,
157
                                                   size_t input_rows_count, bool dry_run) const;
158
    Status _execute_skipped_constant_deal(FunctionContext* context, Block& block,
159
                                          const ColumnNumbers& args, uint32_t result,
160
                                          size_t input_rows_count, bool dry_run) const;
161
};
162
163
/// Function with known arguments and return type.
164
class IFunctionBase {
165
public:
166
113k
    virtual ~IFunctionBase() = default;
167
168
    /// Get the main function name.
169
    virtual String get_name() const = 0;
170
171
    virtual const DataTypes& get_argument_types() const = 0;
172
    virtual const DataTypePtr& get_return_type() const = 0;
173
174
    /// Do preparations and return executable.
175
    /// sample_block should contain data types of arguments and values of constants, if relevant.
176
    virtual PreparedFunctionPtr prepare(FunctionContext* context, const Block& sample_block,
177
                                        const ColumnNumbers& arguments, uint32_t result) const = 0;
178
179
    /// Override this when function need to store state in the `FunctionContext`, or do some
180
    /// preparation work according to information from `FunctionContext`.
181
74.4k
    virtual Status open(FunctionContext* context, FunctionContext::FunctionStateScope scope) {
182
74.4k
        return Status::OK();
183
74.4k
    }
184
185
    Status execute(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
186
98.0k
                   uint32_t result, size_t input_rows_count, bool dry_run = false) const {
187
98.0k
        try {
188
98.0k
            return prepare(context, block, arguments, result)
189
98.0k
                    ->execute(context, block, arguments, result, input_rows_count, dry_run);
190
98.0k
        } catch (const Exception& e) {
191
1
            return e.to_status();
192
1
        }
193
98.0k
    }
194
195
    virtual Status evaluate_inverted_index(
196
            const ColumnsWithTypeAndName& arguments,
197
            const std::vector<vectorized::IndexFieldNameAndTypePair>& data_type_with_names,
198
            std::vector<segment_v2::IndexIterator*> iterators, uint32_t num_rows,
199
0
            segment_v2::InvertedIndexResultBitmap& bitmap_result) const {
200
0
        return Status::OK();
201
0
    }
202
203
    /// Do cleaning work when function is finished, i.e., release state variables in the
204
    /// `FunctionContext` which are registered in `prepare` phase.
205
47.5k
    virtual Status close(FunctionContext* context, FunctionContext::FunctionStateScope scope) {
206
47.5k
        return Status::OK();
207
47.5k
    }
208
209
    virtual bool is_use_default_implementation_for_constants() const = 0;
210
211
0
    virtual bool is_udf_function() const { return false; }
212
213
0
    virtual bool can_push_down_to_index() const { return false; }
214
215
0
    virtual bool is_blockable() const { return false; }
216
};
217
218
using FunctionBasePtr = std::shared_ptr<IFunctionBase>;
219
220
/// Creates IFunctionBase from argument types list.
221
class IFunctionBuilder {
222
public:
223
115k
    virtual ~IFunctionBuilder() = default;
224
225
    /// Get the main function name.
226
    virtual String get_name() const = 0;
227
228
    /// Override and return true if function could take different number of arguments.
229
    ///TODO: this function is not actually used now. but in check_number_of_arguments we still need it because for many
230
    /// functions we didn't set the correct number of arguments.
231
    virtual bool is_variadic() const = 0;
232
233
    /// For non-variadic functions, return number of arguments; otherwise return zero (that should be ignored).
234
    virtual size_t get_number_of_arguments() const = 0;
235
236
    /// Throw if number of arguments is incorrect. Default implementation will check only in non-variadic case.
237
    virtual void check_number_of_arguments(size_t number_of_arguments) const = 0;
238
239
    /// Check arguments and return IFunctionBase.
240
    virtual FunctionBasePtr build(const ColumnsWithTypeAndName& arguments,
241
                                  const DataTypePtr& return_type) const = 0;
242
243
    /// For higher-order functions (functions, that have lambda expression as at least one argument).
244
    /// You pass data types with empty DataTypeFunction for lambda arguments.
245
    /// This function will replace it with DataTypeFunction containing actual types.
246
    virtual DataTypes get_variadic_argument_types() const = 0;
247
248
    /// Returns indexes of arguments, that must be ColumnConst
249
    virtual ColumnNumbers get_arguments_that_are_always_constant() const = 0;
250
};
251
252
using FunctionBuilderPtr = std::shared_ptr<IFunctionBuilder>;
253
254
3
inline std::string get_types_string(const ColumnsWithTypeAndName& arguments) {
255
3
    std::string types;
256
3
    for (const auto& argument : arguments) {
257
2
        if (!types.empty()) {
258
1
            types += ", ";
259
1
        }
260
2
        types += argument.type->get_name();
261
2
    }
262
3
    return types;
263
3
}
264
265
/// used in function_factory. when we register a function, save a builder. to get a function, to get a builder.
266
/// will use DefaultFunctionBuilder as the default builder in function's registration if we didn't explicitly specify.
267
class FunctionBuilderImpl : public IFunctionBuilder {
268
public:
269
    FunctionBasePtr build(const ColumnsWithTypeAndName& arguments,
270
98.5k
                          const DataTypePtr& return_type) const final {
271
98.5k
        if (skip_return_type_check()) {
272
85.9k
            return build_impl(arguments, return_type);
273
85.9k
        }
274
12.6k
        const DataTypePtr& func_return_type = get_return_type(arguments);
275
12.6k
        if (func_return_type == nullptr) {
276
1
            throw doris::Exception(
277
1
                    ErrorCode::INTERNAL_ERROR,
278
1
                    "function return type check failed, function_name={}, "
279
1
                    "expect_return_type={}, real_return_type is nullptr, input_arguments={}",
280
1
                    get_name(), return_type->get_name(), get_types_string(arguments));
281
1
        }
282
283
        // check return types equal.
284
12.6k
        if (!(return_type->equals(*func_return_type) ||
285
              // For null constant argument, `get_return_type` would return
286
              // Nullable<DataTypeNothing> when `use_default_implementation_for_nulls` is true.
287
12.6k
              (return_type->is_nullable() && func_return_type->is_nullable() &&
288
8
               ((DataTypeNullable*)func_return_type.get())
289
4
                               ->get_nested_type()
290
4
                               ->get_primitive_type() == INVALID_TYPE) ||
291
12.6k
              is_date_or_datetime_or_decimal(return_type, func_return_type) ||
292
12.6k
              is_array_nested_type_date_or_datetime_or_decimal(return_type, func_return_type))) {
293
2
            throw doris::Exception(
294
2
                    ErrorCode::INTERNAL_ERROR,
295
2
                    "function return type check failed, function_name={}, "
296
2
                    "fe plan return type={},  be real return type={}, input_arguments={}",
297
2
                    get_name(), return_type->get_name(), func_return_type->get_name(),
298
2
                    get_types_string(arguments));
299
2
        }
300
12.6k
        return build_impl(arguments, return_type);
301
12.6k
    }
302
303
8.92k
    bool is_variadic() const override { return false; }
304
305
    // Default implementation. Will check only in non-variadic case.
306
    void check_number_of_arguments(size_t number_of_arguments) const override;
307
    // the return type should be same with what FE plans.
308
    // it returns: `get_return_type_impl` if `use_default_implementation_for_nulls` = false
309
    //  `get_return_type_impl` warpped in NULL if `use_default_implementation_for_nulls` = true and input has NULL
310
    DataTypePtr get_return_type(const ColumnsWithTypeAndName& arguments) const;
311
312
1.07k
    DataTypes get_variadic_argument_types() const override {
313
1.07k
        return get_variadic_argument_types_impl();
314
1.07k
    }
315
316
0
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {}; }
317
318
protected:
319
    // Get the result type by argument type. If the function does not apply to these arguments, throw an exception.
320
    // the get_return_type_impl and its overrides should only return the nested type if `use_default_implementation_for_nulls` is true.
321
    // whether to wrap in nullable type will be automatically decided.
322
12.4k
    virtual DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const {
323
12.4k
        DataTypes data_types(arguments.size());
324
45.8k
        for (size_t i = 0; i < arguments.size(); ++i) {
325
33.4k
            data_types[i] = arguments[i].type;
326
33.4k
        }
327
12.4k
        return get_return_type_impl(data_types);
328
12.4k
    }
329
330
0
    virtual DataTypePtr get_return_type_impl(const DataTypes& /*arguments*/) const {
331
0
        throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
332
0
                               "get_return_type is not implemented for {}", get_name());
333
0
        return nullptr;
334
0
    }
335
336
    /** If use_default_implementation_for_nulls() is true, than change arguments for get_return_type() and build_impl():
337
      *  if some of arguments are Nullable(Nothing) then don't call get_return_type(), call build_impl() with return_type = Nullable(Nothing),
338
      *  if some of arguments are Nullable, then:
339
      *   - Nullable types are substituted with nested types for get_return_type() function
340
      *   - WRAP get_return_type() RESULT IN NULLABLE type and pass to build_impl
341
      *
342
      * Otherwise build returns build_impl(arguments, get_return_type(arguments));
343
      */
344
0
    virtual bool use_default_implementation_for_nulls() const { return true; }
345
346
0
    virtual bool skip_return_type_check() const { return false; }
347
348
0
    virtual bool need_replace_null_data_to_default() const { return false; }
349
350
    /// return a real function object to execute. called in build(...).
351
    virtual FunctionBasePtr build_impl(const ColumnsWithTypeAndName& arguments,
352
                                       const DataTypePtr& return_type) const = 0;
353
354
351
    virtual DataTypes get_variadic_argument_types_impl() const { return {}; }
355
356
private:
357
    bool is_date_or_datetime_or_decimal(const DataTypePtr& return_type,
358
                                        const DataTypePtr& func_return_type) const;
359
    bool is_array_nested_type_date_or_datetime_or_decimal(
360
            const DataTypePtr& return_type, const DataTypePtr& func_return_type) const;
361
};
362
363
/// Previous function interface.
364
class IFunction : public std::enable_shared_from_this<IFunction>,
365
                  public FunctionBuilderImpl,
366
                  public IFunctionBase,
367
                  public PreparedFunctionImpl {
368
public:
369
    String get_name() const override = 0;
370
371
    /// Notice: We should not change the column in the block, because the column may be shared by multiple expressions or exec nodes.
372
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
373
                        uint32_t result, size_t input_rows_count) const override = 0;
374
375
    /// Override this functions to change default implementation behavior. See details in IMyFunction.
376
30.8k
    bool use_default_implementation_for_nulls() const override { return true; }
377
378
12.6k
    bool skip_return_type_check() const override { return false; }
379
380
7.66k
    bool need_replace_null_data_to_default() const override { return false; }
381
382
    /// all constancy check should use this function to do automatically
383
20.4k
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {}; }
384
385
43
    bool is_use_default_implementation_for_constants() const override {
386
43
        return use_default_implementation_for_constants();
387
43
    }
388
389
    using PreparedFunctionImpl::execute;
390
    using PreparedFunctionImpl::execute_impl_dry_run;
391
    using FunctionBuilderImpl::get_return_type_impl;
392
    using FunctionBuilderImpl::get_variadic_argument_types_impl;
393
    using FunctionBuilderImpl::get_return_type;
394
395
    [[noreturn]] PreparedFunctionPtr prepare(FunctionContext* context,
396
                                             const Block& /*sample_block*/,
397
                                             const ColumnNumbers& /*arguments*/,
398
0
                                             uint32_t /*result*/) const final {
399
0
        throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
400
0
                               "prepare is not implemented for IFunction {}", get_name());
401
0
        __builtin_unreachable();
402
0
    }
403
404
22.9k
    Status open(FunctionContext* context, FunctionContext::FunctionStateScope scope) override {
405
22.9k
        return Status::OK();
406
22.9k
    }
407
408
0
    [[noreturn]] const DataTypes& get_argument_types() const final {
409
0
        throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
410
0
                               "get_argument_types is not implemented for IFunction {}",
411
0
                               get_name());
412
0
        __builtin_unreachable();
413
0
    }
414
415
0
    [[noreturn]] const DataTypePtr& get_return_type() const final {
416
0
        throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
417
0
                               "get_return_type is not implemented for IFunction {}", get_name());
418
0
        __builtin_unreachable();
419
0
    }
420
421
protected:
422
    FunctionBasePtr build_impl(const ColumnsWithTypeAndName& /*arguments*/,
423
0
                               const DataTypePtr& /*return_type*/) const final {
424
0
        throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR,
425
0
                               "build_impl is not implemented for IFunction {}", get_name());
426
0
        __builtin_unreachable();
427
0
        return {};
428
0
    }
429
};
430
431
/*
432
 * when we register a function which didn't specify its base(i.e. inherited from IFunction), actually we use this as a wrapper.
433
 * it saves real implementation as `function`. 
434
*/
435
class DefaultFunction final : public IFunctionBase {
436
public:
437
    DefaultFunction(std::shared_ptr<IFunction> function_, DataTypes arguments_,
438
                    DataTypePtr return_type_)
439
12.6k
            : function(std::move(function_)),
440
12.6k
              arguments(std::move(arguments_)),
441
12.6k
              return_type(std::move(return_type_)) {}
442
443
0
    String get_name() const override { return function->get_name(); }
444
445
0
    const DataTypes& get_argument_types() const override { return arguments; }
446
1
    const DataTypePtr& get_return_type() const override { return return_type; }
447
448
    // return a default wrapper for IFunction.
449
    PreparedFunctionPtr prepare(FunctionContext* context, const Block& /*sample_block*/,
450
                                const ColumnNumbers& /*arguments*/,
451
12.6k
                                uint32_t /*result*/) const override {
452
12.6k
        return function;
453
12.6k
    }
454
455
24.7k
    Status open(FunctionContext* context, FunctionContext::FunctionStateScope scope) override {
456
24.7k
        return function->open(context, scope);
457
24.7k
    }
458
459
24.6k
    Status close(FunctionContext* context, FunctionContext::FunctionStateScope scope) override {
460
24.6k
        return function->close(context, scope);
461
24.6k
    }
462
463
    Status evaluate_inverted_index(
464
            const ColumnsWithTypeAndName& args,
465
            const std::vector<vectorized::IndexFieldNameAndTypePair>& data_type_with_names,
466
            std::vector<segment_v2::IndexIterator*> iterators, uint32_t num_rows,
467
0
            segment_v2::InvertedIndexResultBitmap& bitmap_result) const override {
468
0
        return function->evaluate_inverted_index(args, data_type_with_names, iterators, num_rows,
469
0
                                                 bitmap_result);
470
0
    }
471
472
43
    bool is_use_default_implementation_for_constants() const override {
473
43
        return function->is_use_default_implementation_for_constants();
474
43
    }
475
476
0
    bool can_push_down_to_index() const override { return function->can_push_down_to_index(); }
477
478
0
    bool is_blockable() const override { return function->is_blockable(); }
479
480
private:
481
    std::shared_ptr<IFunction> function;
482
    DataTypes arguments;
483
    DataTypePtr return_type;
484
};
485
486
class DefaultFunctionBuilder : public FunctionBuilderImpl {
487
public:
488
    explicit DefaultFunctionBuilder(std::shared_ptr<IFunction> function_)
489
14.7k
            : function(std::move(function_)) {}
490
491
12.6k
    void check_number_of_arguments(size_t number_of_arguments) const override {
492
12.6k
        function->check_number_of_arguments(number_of_arguments);
493
12.6k
    }
494
495
489
    String get_name() const override { return function->get_name(); }
496
1.03k
    bool is_variadic() const override { return function->is_variadic(); }
497
0
    size_t get_number_of_arguments() const override { return function->get_number_of_arguments(); }
498
499
0
    ColumnNumbers get_arguments_that_are_always_constant() const override {
500
0
        return function->get_arguments_that_are_always_constant();
501
0
    }
502
503
protected:
504
0
    DataTypePtr get_return_type_impl(const DataTypes& arguments) const override {
505
0
        return function->get_return_type_impl(arguments);
506
0
    }
507
12.6k
    DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override {
508
12.6k
        return function->get_return_type_impl(arguments);
509
12.6k
    }
510
511
12.6k
    bool use_default_implementation_for_nulls() const override {
512
12.6k
        return function->use_default_implementation_for_nulls();
513
12.6k
    }
514
515
12.6k
    bool skip_return_type_check() const override { return function->skip_return_type_check(); }
516
517
0
    bool need_replace_null_data_to_default() const override {
518
0
        return function->need_replace_null_data_to_default();
519
0
    }
520
521
    FunctionBasePtr build_impl(const ColumnsWithTypeAndName& arguments,
522
12.6k
                               const DataTypePtr& return_type) const override {
523
12.6k
        DataTypes data_types(arguments.size());
524
46.4k
        for (size_t i = 0; i < arguments.size(); ++i) {
525
33.8k
            data_types[i] = arguments[i].type;
526
33.8k
        }
527
12.6k
        return std::make_shared<DefaultFunction>(function, data_types, return_type);
528
12.6k
    }
529
530
1.06k
    DataTypes get_variadic_argument_types_impl() const override {
531
1.06k
        return function->get_variadic_argument_types_impl();
532
1.06k
    }
533
534
private:
535
    std::shared_ptr<IFunction> function;
536
};
537
538
using FunctionPtr = std::shared_ptr<IFunction>;
539
540
/** Return ColumnNullable of src, with null map as OR-ed null maps of args columns in blocks.
541
  * Or ColumnConst(ColumnNullable) if the result is always NULL or if the result is constant and always not NULL.
542
  */
543
ColumnPtr wrap_in_nullable(const ColumnPtr& src, const Block& block, const ColumnNumbers& args,
544
                           uint32_t result, size_t input_rows_count);
545
546
} // namespace doris::vectorized