Coverage Report

Created: 2026-03-19 18:23

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/function/cast/cast_to_int.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 <type_traits>
21
22
#include "common/status.h"
23
#include "core/data_type/data_type_decimal.h"
24
#include "core/data_type/data_type_number.h"
25
#include "core/data_type/primitive_type.h"
26
#include "exprs/function/cast/cast_to_basic_number_common.h"
27
28
namespace doris {
29
#include "common/compile_check_begin.h"
30
31
// Types that can be cast to int: string, bool, int, float, double, decimal, date, datetime and time.
32
// It's not supported to cast date to tinyint and smallint, because it will definitely overflow.
33
// It's not supported to cast datetime to tinyint and smallint, because it will definitely overflow.
34
// Casting from string and decimal types are handled in `cast_to_basic_number_common.h`.
35
36
// may overflow if:
37
// 1. from wider int to narrower int
38
// 2. from float/double to int
39
// 3. from time to tinyint, smallint and int
40
template <typename FromDataType, typename ToDataType>
41
constexpr bool CastToIntMayOverflow =
42
        (IsDataTypeInt<FromDataType> &&
43
         sizeof(typename FromDataType::FieldType) > sizeof(typename ToDataType::FieldType)) ||
44
        IsDataTypeFloat<FromDataType> ||
45
        (std::is_same_v<FromDataType, DataTypeTimeV2> &&
46
         (std::is_same_v<ToDataType, DataTypeInt32> || std::is_same_v<ToDataType, DataTypeInt16> ||
47
          std::is_same_v<ToDataType, DataTypeInt8>));
48
49
// from number types and timev2 type to integer types which this cast may overflow -> result type is always nullable.
50
template <CastModeType CastMode, typename FromDataType, typename ToDataType>
51
    requires(IsDataTypeInt<ToDataType> &&
52
             (IsDataTypeNumber<FromDataType> || std::is_same_v<FromDataType, DataTypeTimeV2>) &&
53
             CastToIntMayOverflow<FromDataType, ToDataType>)
54
class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase {
55
public:
56
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
57
                        uint32_t result, size_t input_rows_count,
58
2.34k
                        const NullMap::value_type* null_map = nullptr) const override {
59
2.34k
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2.34k
                block.get_by_position(arguments[0]).column.get());
61
2.34k
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2.34k
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
1.34k
        const auto& vec_from = col_from->get_data();
69
1.34k
        auto& vec_to = col_to->get_data();
70
1.34k
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
1.34k
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
1.34k
        CastParameters params;
74
1.34k
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
7.87k
        for (size_t i = 0; i < input_rows_count; ++i) {
76
4.23k
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
520
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
160
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
80
                        vec_null_map_to[i] = 1;
82
80
                        continue;
83
80
                    } else {
84
80
                        return params.status;
85
80
                    }
86
160
                }
87
1.79k
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
1.79k
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
624
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
312
                        vec_null_map_to[i] = 1;
91
312
                        continue;
92
312
                    } else {
93
312
                        return params.status;
94
312
                    }
95
624
                }
96
1.92k
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
1.92k
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
1.80k
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
904
                        vec_null_map_to[i] = 1;
100
904
                        continue;
101
904
                    } else {
102
904
                        return params.status;
103
904
                    }
104
1.80k
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
4.23k
        }
111
2.29k
        block.get_by_position(result).column =
112
2.29k
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
2.29k
        return Status::OK();
115
996
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
10
                        const NullMap::value_type* null_map = nullptr) const override {
59
10
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
10
                block.get_by_position(arguments[0]).column.get());
61
10
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
10
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
10
        const auto& vec_from = col_from->get_data();
69
10
        auto& vec_to = col_to->get_data();
70
10
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
10
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
10
        CastParameters params;
74
10
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
36
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
8
                    } else {
84
8
                        return params.status;
85
8
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
10
        block.get_by_position(result).column =
112
10
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
10
        return Status::OK();
115
10
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
38
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
8
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
8
                        vec_null_map_to[i] = 1;
82
8
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
12
        block.get_by_position(result).column =
112
12
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
12
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
10
                        const NullMap::value_type* null_map = nullptr) const override {
59
10
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
10
                block.get_by_position(arguments[0]).column.get());
61
10
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
10
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
10
        const auto& vec_from = col_from->get_data();
69
10
        auto& vec_to = col_to->get_data();
70
10
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
10
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
10
        CastParameters params;
74
10
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
36
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
8
                    } else {
84
8
                        return params.status;
85
8
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
10
        block.get_by_position(result).column =
112
10
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
10
        return Status::OK();
115
10
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
38
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
8
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
8
                        vec_null_map_to[i] = 1;
82
8
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
12
        block.get_by_position(result).column =
112
12
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
12
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
10
                        const NullMap::value_type* null_map = nullptr) const override {
59
10
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
10
                block.get_by_position(arguments[0]).column.get());
61
10
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
10
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
10
        const auto& vec_from = col_from->get_data();
69
10
        auto& vec_to = col_to->get_data();
70
10
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
10
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
10
        CastParameters params;
74
10
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
36
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
8
                    } else {
84
8
                        return params.status;
85
8
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
10
        block.get_by_position(result).column =
112
10
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
10
        return Status::OK();
115
10
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
38
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
8
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
8
                        vec_null_map_to[i] = 1;
82
8
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
12
        block.get_by_position(result).column =
112
12
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
12
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
10
                        const NullMap::value_type* null_map = nullptr) const override {
59
10
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
10
                block.get_by_position(arguments[0]).column.get());
61
10
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
10
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
10
        const auto& vec_from = col_from->get_data();
69
10
        auto& vec_to = col_to->get_data();
70
10
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
10
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
10
        CastParameters params;
74
10
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
36
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
8
                    } else {
84
8
                        return params.status;
85
8
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
10
        block.get_by_position(result).column =
112
10
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
10
        return Status::OK();
115
10
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
38
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
8
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
8
                        vec_null_map_to[i] = 1;
82
8
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
12
        block.get_by_position(result).column =
112
12
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
12
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
42
                        const NullMap::value_type* null_map = nullptr) const override {
59
42
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
42
                block.get_by_position(arguments[0]).column.get());
61
42
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
42
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
42
        const auto& vec_from = col_from->get_data();
69
42
        auto& vec_to = col_to->get_data();
70
42
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
42
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
42
        CastParameters params;
74
42
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
118
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
76
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
76
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
40
                    } else {
93
40
                        return params.status;
94
40
                    }
95
40
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
76
        }
111
42
        block.get_by_position(result).column =
112
42
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
42
        return Status::OK();
115
42
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
120
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
76
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
76
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
40
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
40
                        vec_null_map_to[i] = 1;
91
40
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
40
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
76
        }
111
44
        block.get_by_position(result).column =
112
44
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
44
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
50
                        const NullMap::value_type* null_map = nullptr) const override {
59
50
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
50
                block.get_by_position(arguments[0]).column.get());
61
50
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
50
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
50
        const auto& vec_from = col_from->get_data();
69
50
        auto& vec_to = col_to->get_data();
70
50
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
50
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
50
        CastParameters params;
74
50
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
134
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
84
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
84
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
48
                    } else {
93
48
                        return params.status;
94
48
                    }
95
48
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
84
        }
111
50
        block.get_by_position(result).column =
112
50
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
50
        return Status::OK();
115
50
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
136
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
84
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
84
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
48
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
48
                        vec_null_map_to[i] = 1;
91
48
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
48
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
84
        }
111
52
        block.get_by_position(result).column =
112
52
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
52
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
320
                        const NullMap::value_type* null_map = nullptr) const override {
59
320
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
320
                block.get_by_position(arguments[0]).column.get());
61
320
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
320
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
320
        const auto& vec_from = col_from->get_data();
69
320
        auto& vec_to = col_to->get_data();
70
320
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
320
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
320
        CastParameters params;
74
320
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
640
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
320
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
320
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
316
                    } else {
102
316
                        return params.status;
103
316
                    }
104
316
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
320
        }
111
320
        block.get_by_position(result).column =
112
320
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
320
        return Status::OK();
115
320
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
320
                        const NullMap::value_type* null_map = nullptr) const override {
59
320
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
320
                block.get_by_position(arguments[0]).column.get());
61
320
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
320
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
320
        const auto& vec_from = col_from->get_data();
69
320
        auto& vec_to = col_to->get_data();
70
320
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
320
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
320
        CastParameters params;
74
320
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
956
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
320
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
320
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
316
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
316
                        vec_null_map_to[i] = 1;
100
316
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
316
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
320
        }
111
636
        block.get_by_position(result).column =
112
636
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
636
        return Status::OK();
115
320
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
10
                        const NullMap::value_type* null_map = nullptr) const override {
59
10
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
10
                block.get_by_position(arguments[0]).column.get());
61
10
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
10
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
10
        const auto& vec_from = col_from->get_data();
69
10
        auto& vec_to = col_to->get_data();
70
10
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
10
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
10
        CastParameters params;
74
10
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
36
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
8
                    } else {
84
8
                        return params.status;
85
8
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
10
        block.get_by_position(result).column =
112
10
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
10
        return Status::OK();
115
10
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
38
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
8
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
8
                        vec_null_map_to[i] = 1;
82
8
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
12
        block.get_by_position(result).column =
112
12
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
12
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
10
                        const NullMap::value_type* null_map = nullptr) const override {
59
10
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
10
                block.get_by_position(arguments[0]).column.get());
61
10
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
10
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
10
        const auto& vec_from = col_from->get_data();
69
10
        auto& vec_to = col_to->get_data();
70
10
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
10
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
10
        CastParameters params;
74
10
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
36
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
8
                    } else {
84
8
                        return params.status;
85
8
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
10
        block.get_by_position(result).column =
112
10
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
10
        return Status::OK();
115
10
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
38
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
8
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
8
                        vec_null_map_to[i] = 1;
82
8
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
12
        block.get_by_position(result).column =
112
12
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
12
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
10
                        const NullMap::value_type* null_map = nullptr) const override {
59
10
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
10
                block.get_by_position(arguments[0]).column.get());
61
10
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
10
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
10
        const auto& vec_from = col_from->get_data();
69
10
        auto& vec_to = col_to->get_data();
70
10
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
10
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
10
        CastParameters params;
74
10
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
36
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
8
                    } else {
84
8
                        return params.status;
85
8
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
10
        block.get_by_position(result).column =
112
10
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
10
        return Status::OK();
115
10
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
38
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
8
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
8
                        vec_null_map_to[i] = 1;
82
8
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
12
        block.get_by_position(result).column =
112
12
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
12
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
38
                        const NullMap::value_type* null_map = nullptr) const override {
59
38
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
38
                block.get_by_position(arguments[0]).column.get());
61
38
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
38
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
38
        const auto& vec_from = col_from->get_data();
69
38
        auto& vec_to = col_to->get_data();
70
38
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
38
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
38
        CastParameters params;
74
38
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
118
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
80
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
80
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
36
                    } else {
93
36
                        return params.status;
94
36
                    }
95
36
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
80
        }
111
38
        block.get_by_position(result).column =
112
38
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
38
        return Status::OK();
115
38
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
120
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
80
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
80
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
36
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
36
                        vec_null_map_to[i] = 1;
91
36
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
36
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
80
        }
111
40
        block.get_by_position(result).column =
112
40
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
40
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
46
                        const NullMap::value_type* null_map = nullptr) const override {
59
46
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
46
                block.get_by_position(arguments[0]).column.get());
61
46
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
46
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
46
        const auto& vec_from = col_from->get_data();
69
46
        auto& vec_to = col_to->get_data();
70
46
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
46
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
46
        CastParameters params;
74
46
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
134
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
88
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
44
                    } else {
93
44
                        return params.status;
94
44
                    }
95
44
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
88
        }
111
46
        block.get_by_position(result).column =
112
46
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
46
        return Status::OK();
115
46
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
136
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
88
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
44
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
44
                        vec_null_map_to[i] = 1;
91
44
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
44
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
88
        }
111
48
        block.get_by_position(result).column =
112
48
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
48
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
320
                        const NullMap::value_type* null_map = nullptr) const override {
59
320
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
320
                block.get_by_position(arguments[0]).column.get());
61
320
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
320
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
320
        const auto& vec_from = col_from->get_data();
69
320
        auto& vec_to = col_to->get_data();
70
320
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
320
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
320
        CastParameters params;
74
320
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
640
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
320
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
320
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
316
                    } else {
102
316
                        return params.status;
103
316
                    }
104
316
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
320
        }
111
320
        block.get_by_position(result).column =
112
320
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
320
        return Status::OK();
115
320
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
320
                        const NullMap::value_type* null_map = nullptr) const override {
59
320
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
320
                block.get_by_position(arguments[0]).column.get());
61
320
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
320
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
320
        const auto& vec_from = col_from->get_data();
69
320
        auto& vec_to = col_to->get_data();
70
320
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
320
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
320
        CastParameters params;
74
320
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
956
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
320
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
320
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
316
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
316
                        vec_null_map_to[i] = 1;
100
316
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
316
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
320
        }
111
636
        block.get_by_position(result).column =
112
636
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
636
        return Status::OK();
115
320
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
10
                        const NullMap::value_type* null_map = nullptr) const override {
59
10
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
10
                block.get_by_position(arguments[0]).column.get());
61
10
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
10
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
10
        const auto& vec_from = col_from->get_data();
69
10
        auto& vec_to = col_to->get_data();
70
10
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
10
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
10
        CastParameters params;
74
10
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
36
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
8
                    } else {
84
8
                        return params.status;
85
8
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
10
        block.get_by_position(result).column =
112
10
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
10
        return Status::OK();
115
10
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
38
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
8
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
8
                        vec_null_map_to[i] = 1;
82
8
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
12
        block.get_by_position(result).column =
112
12
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
12
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
10
                        const NullMap::value_type* null_map = nullptr) const override {
59
10
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
10
                block.get_by_position(arguments[0]).column.get());
61
10
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
10
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
10
        const auto& vec_from = col_from->get_data();
69
10
        auto& vec_to = col_to->get_data();
70
10
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
10
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
10
        CastParameters params;
74
10
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
36
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
8
                    } else {
84
8
                        return params.status;
85
8
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
10
        block.get_by_position(result).column =
112
10
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
10
        return Status::OK();
115
10
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
38
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
8
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
8
                        vec_null_map_to[i] = 1;
82
8
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
12
        block.get_by_position(result).column =
112
12
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
12
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
30
                        const NullMap::value_type* null_map = nullptr) const override {
59
30
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
30
                block.get_by_position(arguments[0]).column.get());
61
30
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
30
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
30
        const auto& vec_from = col_from->get_data();
69
30
        auto& vec_to = col_to->get_data();
70
30
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
30
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
30
        CastParameters params;
74
30
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
118
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
88
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
28
                    } else {
93
28
                        return params.status;
94
28
                    }
95
28
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
88
        }
111
30
        block.get_by_position(result).column =
112
30
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
30
        return Status::OK();
115
30
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
120
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
88
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
28
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
28
                        vec_null_map_to[i] = 1;
91
28
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
28
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
88
        }
111
32
        block.get_by_position(result).column =
112
32
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
32
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
38
                        const NullMap::value_type* null_map = nullptr) const override {
59
38
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
38
                block.get_by_position(arguments[0]).column.get());
61
38
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
38
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
38
        const auto& vec_from = col_from->get_data();
69
38
        auto& vec_to = col_to->get_data();
70
38
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
38
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
38
        CastParameters params;
74
38
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
134
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
96
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
96
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
36
                    } else {
93
36
                        return params.status;
94
36
                    }
95
36
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
96
        }
111
38
        block.get_by_position(result).column =
112
38
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
38
        return Status::OK();
115
38
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
136
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
96
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
96
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
36
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
36
                        vec_null_map_to[i] = 1;
91
36
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
36
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
96
        }
111
40
        block.get_by_position(result).column =
112
40
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
40
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
276
                        const NullMap::value_type* null_map = nullptr) const override {
59
276
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
276
                block.get_by_position(arguments[0]).column.get());
61
276
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
276
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
276
        const auto& vec_from = col_from->get_data();
69
276
        auto& vec_to = col_to->get_data();
70
276
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
276
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
276
        CastParameters params;
74
276
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
596
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
320
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
320
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
272
                    } else {
102
272
                        return params.status;
103
272
                    }
104
272
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
320
        }
111
276
        block.get_by_position(result).column =
112
276
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
276
        return Status::OK();
115
276
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
276
                        const NullMap::value_type* null_map = nullptr) const override {
59
276
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
276
                block.get_by_position(arguments[0]).column.get());
61
276
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
276
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
276
        const auto& vec_from = col_from->get_data();
69
276
        auto& vec_to = col_to->get_data();
70
276
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
276
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
276
        CastParameters params;
74
276
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
868
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
320
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
320
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
272
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
272
                        vec_null_map_to[i] = 1;
100
272
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
272
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
320
        }
111
548
        block.get_by_position(result).column =
112
548
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
548
        return Status::OK();
115
276
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
10
                        const NullMap::value_type* null_map = nullptr) const override {
59
10
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
10
                block.get_by_position(arguments[0]).column.get());
61
10
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
10
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
10
        const auto& vec_from = col_from->get_data();
69
10
        auto& vec_to = col_to->get_data();
70
10
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
10
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
10
        CastParameters params;
74
10
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
36
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
8
                    } else {
84
8
                        return params.status;
85
8
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
10
        block.get_by_position(result).column =
112
10
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
10
        return Status::OK();
115
10
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
38
        for (size_t i = 0; i < input_rows_count; ++i) {
76
26
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
26
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
8
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
8
                        vec_null_map_to[i] = 1;
82
8
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
8
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
26
        }
111
12
        block.get_by_position(result).column =
112
12
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
12
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
22
                        const NullMap::value_type* null_map = nullptr) const override {
59
22
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
22
                block.get_by_position(arguments[0]).column.get());
61
22
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
22
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
22
        const auto& vec_from = col_from->get_data();
69
22
        auto& vec_to = col_to->get_data();
70
22
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
22
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
22
        CastParameters params;
74
22
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
114
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
92
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
92
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
20
                    } else {
93
20
                        return params.status;
94
20
                    }
95
20
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
92
        }
111
22
        block.get_by_position(result).column =
112
22
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
22
        return Status::OK();
115
22
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
116
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
92
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
92
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
20
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
20
                        vec_null_map_to[i] = 1;
91
20
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
20
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
92
        }
111
24
        block.get_by_position(result).column =
112
24
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
24
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
30
                        const NullMap::value_type* null_map = nullptr) const override {
59
30
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
30
                block.get_by_position(arguments[0]).column.get());
61
30
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
30
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
30
        const auto& vec_from = col_from->get_data();
69
30
        auto& vec_to = col_to->get_data();
70
30
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
30
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
30
        CastParameters params;
74
30
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
130
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
100
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
100
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
28
                    } else {
93
28
                        return params.status;
94
28
                    }
95
28
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
100
        }
111
30
        block.get_by_position(result).column =
112
30
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
30
        return Status::OK();
115
30
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
132
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
100
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
100
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
28
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
28
                        vec_null_map_to[i] = 1;
91
28
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
28
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
100
        }
111
32
        block.get_by_position(result).column =
112
32
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
32
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
14
                        const NullMap::value_type* null_map = nullptr) const override {
59
14
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
14
                block.get_by_position(arguments[0]).column.get());
61
14
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
14
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
14
        const auto& vec_from = col_from->get_data();
69
14
        auto& vec_to = col_to->get_data();
70
14
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
14
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
14
        CastParameters params;
74
14
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
106
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
92
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
92
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
12
                    } else {
93
12
                        return params.status;
94
12
                    }
95
12
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
92
        }
111
14
        block.get_by_position(result).column =
112
14
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
14
        return Status::OK();
115
14
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
108
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
92
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
92
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
12
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
12
                        vec_null_map_to[i] = 1;
91
12
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
12
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
92
        }
111
16
        block.get_by_position(result).column =
112
16
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
16
        return Status::OK();
115
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
22
                        const NullMap::value_type* null_map = nullptr) const override {
59
22
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
22
                block.get_by_position(arguments[0]).column.get());
61
22
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
22
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
22
        const auto& vec_from = col_from->get_data();
69
22
        auto& vec_to = col_to->get_data();
70
22
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
22
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
22
        CastParameters params;
74
22
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
122
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
100
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
100
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
20
                    } else {
93
20
                        return params.status;
94
20
                    }
95
20
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
100
        }
111
22
        block.get_by_position(result).column =
112
22
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
22
        return Status::OK();
115
22
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
4
                        const NullMap::value_type* null_map = nullptr) const override {
59
4
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
4
                block.get_by_position(arguments[0]).column.get());
61
4
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
4
        const auto& vec_from = col_from->get_data();
69
4
        auto& vec_to = col_to->get_data();
70
4
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
4
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
4
        CastParameters params;
74
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
124
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
100
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
100
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
20
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
20
                        vec_null_map_to[i] = 1;
91
20
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
20
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
100
        }
111
24
        block.get_by_position(result).column =
112
24
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
24
        return Status::OK();
115
4
    }
116
};
117
118
/// cast to int, will not overflow and no nullable output:
119
/// 1. from bool;
120
/// 2. from narrow int to wider int
121
/// 3. from time to bigint and largeint
122
template <CastModeType CastMode, typename FromDataType, typename ToDataType>
123
    requires(IsDataTypeInt<ToDataType> &&
124
             (IsDataTypeNumber<FromDataType> || std::is_same_v<FromDataType, DataTypeTimeV2>) &&
125
             !CastToIntMayOverflow<FromDataType, ToDataType>)
126
class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase {
127
public:
128
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
129
                        uint32_t result, size_t input_rows_count,
130
598
                        const NullMap::value_type* null_map = nullptr) const override {
131
598
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
598
                                                                 input_rows_count);
133
598
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
4
                        const NullMap::value_type* null_map = nullptr) const override {
131
4
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
4
                                                                 input_rows_count);
133
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
4
                        const NullMap::value_type* null_map = nullptr) const override {
131
4
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
4
                                                                 input_rows_count);
133
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
4
                        const NullMap::value_type* null_map = nullptr) const override {
131
4
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
4
                                                                 input_rows_count);
133
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
156
                        const NullMap::value_type* null_map = nullptr) const override {
131
156
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
156
                                                                 input_rows_count);
133
156
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
4
                        const NullMap::value_type* null_map = nullptr) const override {
131
4
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
4
                                                                 input_rows_count);
133
4
    }
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
4
                        const NullMap::value_type* null_map = nullptr) const override {
131
4
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
4
                                                                 input_rows_count);
133
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
4
                        const NullMap::value_type* null_map = nullptr) const override {
131
4
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
4
                                                                 input_rows_count);
133
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
171
                        const NullMap::value_type* null_map = nullptr) const override {
131
171
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
171
                                                                 input_rows_count);
133
171
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
193
                        const NullMap::value_type* null_map = nullptr) const override {
131
193
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
193
                                                                 input_rows_count);
133
193
    }
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
4
                        const NullMap::value_type* null_map = nullptr) const override {
131
4
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
4
                                                                 input_rows_count);
133
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
4
                        const NullMap::value_type* null_map = nullptr) const override {
131
4
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
4
                                                                 input_rows_count);
133
4
    }
134
};
135
136
// cast decimal to integer. always use overflow check to decide nullable
137
template <CastModeType CastMode, typename FromDataType, typename ToDataType>
138
    requires(IsDataTypeInt<ToDataType> && IsDataTypeDecimal<FromDataType>)
139
class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase {
140
public:
141
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
142
                        uint32_t result, size_t input_rows_count,
143
760
                        const NullMap::value_type* null_map = nullptr) const override {
144
760
        using ToFieldType = typename ToDataType::FieldType;
145
760
        using FromFieldType = typename FromDataType::FieldType;
146
147
760
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
760
        const auto* col_from =
149
760
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
760
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
760
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
760
        UInt32 from_precision = from_decimal_type.get_precision();
157
760
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
760
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
760
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
760
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
760
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
760
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
760
        const auto& vec_from = col_from->get_data();
170
760
        const auto* vec_from_data = vec_from.data();
171
760
        auto& vec_to = col_to->get_data();
172
760
        auto* vec_to_data = vec_to.data();
173
174
760
        ColumnUInt8::MutablePtr col_null_map_to;
175
760
        NullMap::value_type* null_map_data = nullptr;
176
760
        if (overflow_and_nullable) {
177
292
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
292
            null_map_data = col_null_map_to->get_data().data();
179
292
        }
180
181
760
        CastParameters params;
182
760
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
760
        size_t size = vec_from.size();
184
760
        typename FromFieldType::NativeType scale_multiplier =
185
760
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
44.9k
        for (size_t i = 0; i < size; i++) {
187
44.2k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
44.2k
                                          typename ToDataType::FieldType>(
189
44.2k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
44.2k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
44.2k
        }
198
199
760
        if (overflow_and_nullable) {
200
292
            block.get_by_position(result).column =
201
292
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
468
        } else {
203
468
            block.get_by_position(result).column = std::move(col_to);
204
468
        }
205
760
        return Status::OK();
206
760
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
14
                        const NullMap::value_type* null_map = nullptr) const override {
144
14
        using ToFieldType = typename ToDataType::FieldType;
145
14
        using FromFieldType = typename FromDataType::FieldType;
146
147
14
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
14
        const auto* col_from =
149
14
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
14
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
14
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
14
        UInt32 from_precision = from_decimal_type.get_precision();
157
14
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
14
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
14
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
14
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
14
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
14
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
14
        const auto& vec_from = col_from->get_data();
170
14
        const auto* vec_from_data = vec_from.data();
171
14
        auto& vec_to = col_to->get_data();
172
14
        auto* vec_to_data = vec_to.data();
173
174
14
        ColumnUInt8::MutablePtr col_null_map_to;
175
14
        NullMap::value_type* null_map_data = nullptr;
176
14
        if (overflow_and_nullable) {
177
6
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
6
            null_map_data = col_null_map_to->get_data().data();
179
6
        }
180
181
14
        CastParameters params;
182
14
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
14
        size_t size = vec_from.size();
184
14
        typename FromFieldType::NativeType scale_multiplier =
185
14
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
604
        for (size_t i = 0; i < size; i++) {
187
590
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
590
                                          typename ToDataType::FieldType>(
189
590
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
590
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
590
        }
198
199
14
        if (overflow_and_nullable) {
200
6
            block.get_by_position(result).column =
201
6
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
14
        return Status::OK();
206
14
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
14
                        const NullMap::value_type* null_map = nullptr) const override {
144
14
        using ToFieldType = typename ToDataType::FieldType;
145
14
        using FromFieldType = typename FromDataType::FieldType;
146
147
14
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
14
        const auto* col_from =
149
14
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
14
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
14
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
14
        UInt32 from_precision = from_decimal_type.get_precision();
157
14
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
14
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
14
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
14
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
14
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
14
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
14
        const auto& vec_from = col_from->get_data();
170
14
        const auto* vec_from_data = vec_from.data();
171
14
        auto& vec_to = col_to->get_data();
172
14
        auto* vec_to_data = vec_to.data();
173
174
14
        ColumnUInt8::MutablePtr col_null_map_to;
175
14
        NullMap::value_type* null_map_data = nullptr;
176
14
        if (overflow_and_nullable) {
177
6
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
6
            null_map_data = col_null_map_to->get_data().data();
179
6
        }
180
181
14
        CastParameters params;
182
14
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
14
        size_t size = vec_from.size();
184
14
        typename FromFieldType::NativeType scale_multiplier =
185
14
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
604
        for (size_t i = 0; i < size; i++) {
187
590
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
590
                                          typename ToDataType::FieldType>(
189
590
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
590
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
590
        }
198
199
14
        if (overflow_and_nullable) {
200
6
            block.get_by_position(result).column =
201
6
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
14
        return Status::OK();
206
14
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
8
                        const NullMap::value_type* null_map = nullptr) const override {
144
8
        using ToFieldType = typename ToDataType::FieldType;
145
8
        using FromFieldType = typename FromDataType::FieldType;
146
147
8
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
8
        const auto* col_from =
149
8
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
8
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
8
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
8
        UInt32 from_precision = from_decimal_type.get_precision();
157
8
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
8
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
8
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
8
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
8
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
8
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
8
        const auto& vec_from = col_from->get_data();
170
8
        const auto* vec_from_data = vec_from.data();
171
8
        auto& vec_to = col_to->get_data();
172
8
        auto* vec_to_data = vec_to.data();
173
174
8
        ColumnUInt8::MutablePtr col_null_map_to;
175
8
        NullMap::value_type* null_map_data = nullptr;
176
8
        if (overflow_and_nullable) {
177
8
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
8
            null_map_data = col_null_map_to->get_data().data();
179
8
        }
180
181
8
        CastParameters params;
182
8
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
8
        size_t size = vec_from.size();
184
8
        typename FromFieldType::NativeType scale_multiplier =
185
8
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
296
        for (size_t i = 0; i < size; i++) {
187
288
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
288
                                          typename ToDataType::FieldType>(
189
288
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
288
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
288
        }
198
199
8
        if (overflow_and_nullable) {
200
8
            block.get_by_position(result).column =
201
8
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
0
            block.get_by_position(result).column = std::move(col_to);
204
0
        }
205
8
        return Status::OK();
206
8
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
8
                        const NullMap::value_type* null_map = nullptr) const override {
144
8
        using ToFieldType = typename ToDataType::FieldType;
145
8
        using FromFieldType = typename FromDataType::FieldType;
146
147
8
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
8
        const auto* col_from =
149
8
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
8
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
8
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
8
        UInt32 from_precision = from_decimal_type.get_precision();
157
8
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
8
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
8
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
8
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
8
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
8
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
8
        const auto& vec_from = col_from->get_data();
170
8
        const auto* vec_from_data = vec_from.data();
171
8
        auto& vec_to = col_to->get_data();
172
8
        auto* vec_to_data = vec_to.data();
173
174
8
        ColumnUInt8::MutablePtr col_null_map_to;
175
8
        NullMap::value_type* null_map_data = nullptr;
176
8
        if (overflow_and_nullable) {
177
8
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
8
            null_map_data = col_null_map_to->get_data().data();
179
8
        }
180
181
8
        CastParameters params;
182
8
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
8
        size_t size = vec_from.size();
184
8
        typename FromFieldType::NativeType scale_multiplier =
185
8
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
296
        for (size_t i = 0; i < size; i++) {
187
288
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
288
                                          typename ToDataType::FieldType>(
189
288
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
288
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
288
        }
198
199
8
        if (overflow_and_nullable) {
200
8
            block.get_by_position(result).column =
201
8
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
0
            block.get_by_position(result).column = std::move(col_to);
204
0
        }
205
8
        return Status::OK();
206
8
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
14
                        const NullMap::value_type* null_map = nullptr) const override {
144
14
        using ToFieldType = typename ToDataType::FieldType;
145
14
        using FromFieldType = typename FromDataType::FieldType;
146
147
14
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
14
        const auto* col_from =
149
14
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
14
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
14
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
14
        UInt32 from_precision = from_decimal_type.get_precision();
157
14
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
14
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
14
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
14
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
14
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
14
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
14
        const auto& vec_from = col_from->get_data();
170
14
        const auto* vec_from_data = vec_from.data();
171
14
        auto& vec_to = col_to->get_data();
172
14
        auto* vec_to_data = vec_to.data();
173
174
14
        ColumnUInt8::MutablePtr col_null_map_to;
175
14
        NullMap::value_type* null_map_data = nullptr;
176
14
        if (overflow_and_nullable) {
177
6
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
6
            null_map_data = col_null_map_to->get_data().data();
179
6
        }
180
181
14
        CastParameters params;
182
14
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
14
        size_t size = vec_from.size();
184
14
        typename FromFieldType::NativeType scale_multiplier =
185
14
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
604
        for (size_t i = 0; i < size; i++) {
187
590
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
590
                                          typename ToDataType::FieldType>(
189
590
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
590
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
590
        }
198
199
14
        if (overflow_and_nullable) {
200
6
            block.get_by_position(result).column =
201
6
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
14
        return Status::OK();
206
14
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
14
                        const NullMap::value_type* null_map = nullptr) const override {
144
14
        using ToFieldType = typename ToDataType::FieldType;
145
14
        using FromFieldType = typename FromDataType::FieldType;
146
147
14
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
14
        const auto* col_from =
149
14
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
14
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
14
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
14
        UInt32 from_precision = from_decimal_type.get_precision();
157
14
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
14
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
14
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
14
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
14
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
14
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
14
        const auto& vec_from = col_from->get_data();
170
14
        const auto* vec_from_data = vec_from.data();
171
14
        auto& vec_to = col_to->get_data();
172
14
        auto* vec_to_data = vec_to.data();
173
174
14
        ColumnUInt8::MutablePtr col_null_map_to;
175
14
        NullMap::value_type* null_map_data = nullptr;
176
14
        if (overflow_and_nullable) {
177
6
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
6
            null_map_data = col_null_map_to->get_data().data();
179
6
        }
180
181
14
        CastParameters params;
182
14
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
14
        size_t size = vec_from.size();
184
14
        typename FromFieldType::NativeType scale_multiplier =
185
14
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
604
        for (size_t i = 0; i < size; i++) {
187
590
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
590
                                          typename ToDataType::FieldType>(
189
590
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
590
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
590
        }
198
199
14
        if (overflow_and_nullable) {
200
6
            block.get_by_position(result).column =
201
6
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
14
        return Status::OK();
206
14
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
8
                        const NullMap::value_type* null_map = nullptr) const override {
144
8
        using ToFieldType = typename ToDataType::FieldType;
145
8
        using FromFieldType = typename FromDataType::FieldType;
146
147
8
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
8
        const auto* col_from =
149
8
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
8
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
8
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
8
        UInt32 from_precision = from_decimal_type.get_precision();
157
8
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
8
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
8
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
8
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
8
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
8
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
8
        const auto& vec_from = col_from->get_data();
170
8
        const auto* vec_from_data = vec_from.data();
171
8
        auto& vec_to = col_to->get_data();
172
8
        auto* vec_to_data = vec_to.data();
173
174
8
        ColumnUInt8::MutablePtr col_null_map_to;
175
8
        NullMap::value_type* null_map_data = nullptr;
176
8
        if (overflow_and_nullable) {
177
8
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
8
            null_map_data = col_null_map_to->get_data().data();
179
8
        }
180
181
8
        CastParameters params;
182
8
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
8
        size_t size = vec_from.size();
184
8
        typename FromFieldType::NativeType scale_multiplier =
185
8
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
296
        for (size_t i = 0; i < size; i++) {
187
288
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
288
                                          typename ToDataType::FieldType>(
189
288
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
288
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
288
        }
198
199
8
        if (overflow_and_nullable) {
200
8
            block.get_by_position(result).column =
201
8
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
0
            block.get_by_position(result).column = std::move(col_to);
204
0
        }
205
8
        return Status::OK();
206
8
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
8
                        const NullMap::value_type* null_map = nullptr) const override {
144
8
        using ToFieldType = typename ToDataType::FieldType;
145
8
        using FromFieldType = typename FromDataType::FieldType;
146
147
8
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
8
        const auto* col_from =
149
8
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
8
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
8
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
8
        UInt32 from_precision = from_decimal_type.get_precision();
157
8
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
8
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
8
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
8
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
8
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
8
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
8
        const auto& vec_from = col_from->get_data();
170
8
        const auto* vec_from_data = vec_from.data();
171
8
        auto& vec_to = col_to->get_data();
172
8
        auto* vec_to_data = vec_to.data();
173
174
8
        ColumnUInt8::MutablePtr col_null_map_to;
175
8
        NullMap::value_type* null_map_data = nullptr;
176
8
        if (overflow_and_nullable) {
177
8
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
8
            null_map_data = col_null_map_to->get_data().data();
179
8
        }
180
181
8
        CastParameters params;
182
8
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
8
        size_t size = vec_from.size();
184
8
        typename FromFieldType::NativeType scale_multiplier =
185
8
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
296
        for (size_t i = 0; i < size; i++) {
187
288
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
288
                                          typename ToDataType::FieldType>(
189
288
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
288
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
288
        }
198
199
8
        if (overflow_and_nullable) {
200
8
            block.get_by_position(result).column =
201
8
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
0
            block.get_by_position(result).column = std::move(col_to);
204
0
        }
205
8
        return Status::OK();
206
8
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
14
                        const NullMap::value_type* null_map = nullptr) const override {
144
14
        using ToFieldType = typename ToDataType::FieldType;
145
14
        using FromFieldType = typename FromDataType::FieldType;
146
147
14
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
14
        const auto* col_from =
149
14
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
14
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
14
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
14
        UInt32 from_precision = from_decimal_type.get_precision();
157
14
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
14
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
14
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
14
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
14
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
14
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
14
        const auto& vec_from = col_from->get_data();
170
14
        const auto* vec_from_data = vec_from.data();
171
14
        auto& vec_to = col_to->get_data();
172
14
        auto* vec_to_data = vec_to.data();
173
174
14
        ColumnUInt8::MutablePtr col_null_map_to;
175
14
        NullMap::value_type* null_map_data = nullptr;
176
14
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
14
        CastParameters params;
182
14
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
14
        size_t size = vec_from.size();
184
14
        typename FromFieldType::NativeType scale_multiplier =
185
14
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
910
        for (size_t i = 0; i < size; i++) {
187
896
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
896
                                          typename ToDataType::FieldType>(
189
896
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
896
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
896
        }
198
199
14
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
14
        } else {
203
14
            block.get_by_position(result).column = std::move(col_to);
204
14
        }
205
14
        return Status::OK();
206
14
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
14
                        const NullMap::value_type* null_map = nullptr) const override {
144
14
        using ToFieldType = typename ToDataType::FieldType;
145
14
        using FromFieldType = typename FromDataType::FieldType;
146
147
14
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
14
        const auto* col_from =
149
14
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
14
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
14
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
14
        UInt32 from_precision = from_decimal_type.get_precision();
157
14
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
14
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
14
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
14
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
14
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
14
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
14
        const auto& vec_from = col_from->get_data();
170
14
        const auto* vec_from_data = vec_from.data();
171
14
        auto& vec_to = col_to->get_data();
172
14
        auto* vec_to_data = vec_to.data();
173
174
14
        ColumnUInt8::MutablePtr col_null_map_to;
175
14
        NullMap::value_type* null_map_data = nullptr;
176
14
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
14
        CastParameters params;
182
14
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
14
        size_t size = vec_from.size();
184
14
        typename FromFieldType::NativeType scale_multiplier =
185
14
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
910
        for (size_t i = 0; i < size; i++) {
187
896
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
896
                                          typename ToDataType::FieldType>(
189
896
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
896
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
896
        }
198
199
14
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
14
        } else {
203
14
            block.get_by_position(result).column = std::move(col_to);
204
14
        }
205
14
        return Status::OK();
206
14
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
6
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
6
            null_map_data = col_null_map_to->get_data().data();
179
6
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
1.24k
        for (size_t i = 0; i < size; i++) {
187
1.22k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
1.22k
                                          typename ToDataType::FieldType>(
189
1.22k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
1.22k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
1.22k
        }
198
199
18
        if (overflow_and_nullable) {
200
6
            block.get_by_position(result).column =
201
6
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
12
        } else {
203
12
            block.get_by_position(result).column = std::move(col_to);
204
12
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
6
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
6
            null_map_data = col_null_map_to->get_data().data();
179
6
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
1.24k
        for (size_t i = 0; i < size; i++) {
187
1.22k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
1.22k
                                          typename ToDataType::FieldType>(
189
1.22k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
1.22k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
1.22k
        }
198
199
18
        if (overflow_and_nullable) {
200
6
            block.get_by_position(result).column =
201
6
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
12
        } else {
203
12
            block.get_by_position(result).column = std::move(col_to);
204
12
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
8
                        const NullMap::value_type* null_map = nullptr) const override {
144
8
        using ToFieldType = typename ToDataType::FieldType;
145
8
        using FromFieldType = typename FromDataType::FieldType;
146
147
8
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
8
        const auto* col_from =
149
8
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
8
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
8
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
8
        UInt32 from_precision = from_decimal_type.get_precision();
157
8
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
8
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
8
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
8
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
8
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
8
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
8
        const auto& vec_from = col_from->get_data();
170
8
        const auto* vec_from_data = vec_from.data();
171
8
        auto& vec_to = col_to->get_data();
172
8
        auto* vec_to_data = vec_to.data();
173
174
8
        ColumnUInt8::MutablePtr col_null_map_to;
175
8
        NullMap::value_type* null_map_data = nullptr;
176
8
        if (overflow_and_nullable) {
177
8
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
8
            null_map_data = col_null_map_to->get_data().data();
179
8
        }
180
181
8
        CastParameters params;
182
8
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
8
        size_t size = vec_from.size();
184
8
        typename FromFieldType::NativeType scale_multiplier =
185
8
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
296
        for (size_t i = 0; i < size; i++) {
187
288
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
288
                                          typename ToDataType::FieldType>(
189
288
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
288
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
288
        }
198
199
8
        if (overflow_and_nullable) {
200
8
            block.get_by_position(result).column =
201
8
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
0
            block.get_by_position(result).column = std::move(col_to);
204
0
        }
205
8
        return Status::OK();
206
8
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
8
                        const NullMap::value_type* null_map = nullptr) const override {
144
8
        using ToFieldType = typename ToDataType::FieldType;
145
8
        using FromFieldType = typename FromDataType::FieldType;
146
147
8
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
8
        const auto* col_from =
149
8
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
8
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
8
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
8
        UInt32 from_precision = from_decimal_type.get_precision();
157
8
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
8
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
8
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
8
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
8
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
8
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
8
        const auto& vec_from = col_from->get_data();
170
8
        const auto* vec_from_data = vec_from.data();
171
8
        auto& vec_to = col_to->get_data();
172
8
        auto* vec_to_data = vec_to.data();
173
174
8
        ColumnUInt8::MutablePtr col_null_map_to;
175
8
        NullMap::value_type* null_map_data = nullptr;
176
8
        if (overflow_and_nullable) {
177
8
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
8
            null_map_data = col_null_map_to->get_data().data();
179
8
        }
180
181
8
        CastParameters params;
182
8
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
8
        size_t size = vec_from.size();
184
8
        typename FromFieldType::NativeType scale_multiplier =
185
8
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
296
        for (size_t i = 0; i < size; i++) {
187
288
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
288
                                          typename ToDataType::FieldType>(
189
288
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
288
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
288
        }
198
199
8
        if (overflow_and_nullable) {
200
8
            block.get_by_position(result).column =
201
8
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
0
            block.get_by_position(result).column = std::move(col_to);
204
0
        }
205
8
        return Status::OK();
206
8
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
14
                        const NullMap::value_type* null_map = nullptr) const override {
144
14
        using ToFieldType = typename ToDataType::FieldType;
145
14
        using FromFieldType = typename FromDataType::FieldType;
146
147
14
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
14
        const auto* col_from =
149
14
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
14
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
14
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
14
        UInt32 from_precision = from_decimal_type.get_precision();
157
14
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
14
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
14
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
14
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
14
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
14
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
14
        const auto& vec_from = col_from->get_data();
170
14
        const auto* vec_from_data = vec_from.data();
171
14
        auto& vec_to = col_to->get_data();
172
14
        auto* vec_to_data = vec_to.data();
173
174
14
        ColumnUInt8::MutablePtr col_null_map_to;
175
14
        NullMap::value_type* null_map_data = nullptr;
176
14
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
14
        CastParameters params;
182
14
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
14
        size_t size = vec_from.size();
184
14
        typename FromFieldType::NativeType scale_multiplier =
185
14
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
910
        for (size_t i = 0; i < size; i++) {
187
896
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
896
                                          typename ToDataType::FieldType>(
189
896
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
896
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
896
        }
198
199
14
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
14
        } else {
203
14
            block.get_by_position(result).column = std::move(col_to);
204
14
        }
205
14
        return Status::OK();
206
14
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
14
                        const NullMap::value_type* null_map = nullptr) const override {
144
14
        using ToFieldType = typename ToDataType::FieldType;
145
14
        using FromFieldType = typename FromDataType::FieldType;
146
147
14
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
14
        const auto* col_from =
149
14
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
14
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
14
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
14
        UInt32 from_precision = from_decimal_type.get_precision();
157
14
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
14
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
14
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
14
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
14
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
14
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
14
        const auto& vec_from = col_from->get_data();
170
14
        const auto* vec_from_data = vec_from.data();
171
14
        auto& vec_to = col_to->get_data();
172
14
        auto* vec_to_data = vec_to.data();
173
174
14
        ColumnUInt8::MutablePtr col_null_map_to;
175
14
        NullMap::value_type* null_map_data = nullptr;
176
14
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
14
        CastParameters params;
182
14
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
14
        size_t size = vec_from.size();
184
14
        typename FromFieldType::NativeType scale_multiplier =
185
14
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
910
        for (size_t i = 0; i < size; i++) {
187
896
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
896
                                          typename ToDataType::FieldType>(
189
896
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
896
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
896
        }
198
199
14
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
14
        } else {
203
14
            block.get_by_position(result).column = std::move(col_to);
204
14
        }
205
14
        return Status::OK();
206
14
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
1.42k
        for (size_t i = 0; i < size; i++) {
187
1.40k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
1.40k
                                          typename ToDataType::FieldType>(
189
1.40k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
1.40k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
1.40k
        }
198
199
18
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
18
        } else {
203
18
            block.get_by_position(result).column = std::move(col_to);
204
18
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
1.42k
        for (size_t i = 0; i < size; i++) {
187
1.40k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
1.40k
                                          typename ToDataType::FieldType>(
189
1.40k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
1.40k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
1.40k
        }
198
199
18
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
18
        } else {
203
18
            block.get_by_position(result).column = std::move(col_to);
204
18
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
8
                        const NullMap::value_type* null_map = nullptr) const override {
144
8
        using ToFieldType = typename ToDataType::FieldType;
145
8
        using FromFieldType = typename FromDataType::FieldType;
146
147
8
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
8
        const auto* col_from =
149
8
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
8
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
8
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
8
        UInt32 from_precision = from_decimal_type.get_precision();
157
8
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
8
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
8
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
8
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
8
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
8
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
8
        const auto& vec_from = col_from->get_data();
170
8
        const auto* vec_from_data = vec_from.data();
171
8
        auto& vec_to = col_to->get_data();
172
8
        auto* vec_to_data = vec_to.data();
173
174
8
        ColumnUInt8::MutablePtr col_null_map_to;
175
8
        NullMap::value_type* null_map_data = nullptr;
176
8
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
8
        CastParameters params;
182
8
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
8
        size_t size = vec_from.size();
184
8
        typename FromFieldType::NativeType scale_multiplier =
185
8
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
584
        for (size_t i = 0; i < size; i++) {
187
576
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
576
                                          typename ToDataType::FieldType>(
189
576
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
576
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
576
        }
198
199
8
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
8
        return Status::OK();
206
8
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
8
                        const NullMap::value_type* null_map = nullptr) const override {
144
8
        using ToFieldType = typename ToDataType::FieldType;
145
8
        using FromFieldType = typename FromDataType::FieldType;
146
147
8
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
8
        const auto* col_from =
149
8
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
8
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
8
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
8
        UInt32 from_precision = from_decimal_type.get_precision();
157
8
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
8
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
8
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
8
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
8
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
8
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
8
        const auto& vec_from = col_from->get_data();
170
8
        const auto* vec_from_data = vec_from.data();
171
8
        auto& vec_to = col_to->get_data();
172
8
        auto* vec_to_data = vec_to.data();
173
174
8
        ColumnUInt8::MutablePtr col_null_map_to;
175
8
        NullMap::value_type* null_map_data = nullptr;
176
8
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
8
        CastParameters params;
182
8
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
8
        size_t size = vec_from.size();
184
8
        typename FromFieldType::NativeType scale_multiplier =
185
8
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
584
        for (size_t i = 0; i < size; i++) {
187
576
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
576
                                          typename ToDataType::FieldType>(
189
576
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
576
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
576
        }
198
199
8
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
8
        return Status::OK();
206
8
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
8
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
8
            null_map_data = col_null_map_to->get_data().data();
179
8
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
1.10k
        for (size_t i = 0; i < size; i++) {
187
1.08k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
1.08k
                                          typename ToDataType::FieldType>(
189
1.08k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
1.08k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
1.08k
        }
198
199
18
        if (overflow_and_nullable) {
200
8
            block.get_by_position(result).column =
201
8
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
10
            block.get_by_position(result).column = std::move(col_to);
204
10
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
8
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
8
            null_map_data = col_null_map_to->get_data().data();
179
8
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
1.10k
        for (size_t i = 0; i < size; i++) {
187
1.08k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
1.08k
                                          typename ToDataType::FieldType>(
189
1.08k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
1.08k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
1.08k
        }
198
199
18
        if (overflow_and_nullable) {
200
8
            block.get_by_position(result).column =
201
8
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
10
            block.get_by_position(result).column = std::move(col_to);
204
10
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
10
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
10
            null_map_data = col_null_map_to->get_data().data();
179
10
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
958
        for (size_t i = 0; i < size; i++) {
187
940
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
940
                                          typename ToDataType::FieldType>(
189
940
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
940
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
940
        }
198
199
18
        if (overflow_and_nullable) {
200
10
            block.get_by_position(result).column =
201
10
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
10
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
14
                        const NullMap::value_type* null_map = nullptr) const override {
144
14
        using ToFieldType = typename ToDataType::FieldType;
145
14
        using FromFieldType = typename FromDataType::FieldType;
146
147
14
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
14
        const auto* col_from =
149
14
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
14
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
14
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
14
        UInt32 from_precision = from_decimal_type.get_precision();
157
14
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
14
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
14
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
14
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
14
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
14
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
14
        const auto& vec_from = col_from->get_data();
170
14
        const auto* vec_from_data = vec_from.data();
171
14
        auto& vec_to = col_to->get_data();
172
14
        auto* vec_to_data = vec_to.data();
173
174
14
        ColumnUInt8::MutablePtr col_null_map_to;
175
14
        NullMap::value_type* null_map_data = nullptr;
176
14
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
14
        CastParameters params;
182
14
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
14
        size_t size = vec_from.size();
184
14
        typename FromFieldType::NativeType scale_multiplier =
185
14
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
910
        for (size_t i = 0; i < size; i++) {
187
896
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
896
                                          typename ToDataType::FieldType>(
189
896
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
896
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
896
        }
198
199
14
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
14
        } else {
203
14
            block.get_by_position(result).column = std::move(col_to);
204
14
        }
205
14
        return Status::OK();
206
14
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
14
                        const NullMap::value_type* null_map = nullptr) const override {
144
14
        using ToFieldType = typename ToDataType::FieldType;
145
14
        using FromFieldType = typename FromDataType::FieldType;
146
147
14
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
14
        const auto* col_from =
149
14
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
14
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
14
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
14
        UInt32 from_precision = from_decimal_type.get_precision();
157
14
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
14
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
14
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
14
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
14
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
14
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
14
        const auto& vec_from = col_from->get_data();
170
14
        const auto* vec_from_data = vec_from.data();
171
14
        auto& vec_to = col_to->get_data();
172
14
        auto* vec_to_data = vec_to.data();
173
174
14
        ColumnUInt8::MutablePtr col_null_map_to;
175
14
        NullMap::value_type* null_map_data = nullptr;
176
14
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
14
        CastParameters params;
182
14
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
14
        size_t size = vec_from.size();
184
14
        typename FromFieldType::NativeType scale_multiplier =
185
14
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
910
        for (size_t i = 0; i < size; i++) {
187
896
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
896
                                          typename ToDataType::FieldType>(
189
896
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
896
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
896
        }
198
199
14
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
14
        } else {
203
14
            block.get_by_position(result).column = std::move(col_to);
204
14
        }
205
14
        return Status::OK();
206
14
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
1.42k
        for (size_t i = 0; i < size; i++) {
187
1.40k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
1.40k
                                          typename ToDataType::FieldType>(
189
1.40k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
1.40k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
1.40k
        }
198
199
18
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
18
        } else {
203
18
            block.get_by_position(result).column = std::move(col_to);
204
18
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
1.42k
        for (size_t i = 0; i < size; i++) {
187
1.40k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
1.40k
                                          typename ToDataType::FieldType>(
189
1.40k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
1.40k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
1.40k
        }
198
199
18
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
18
        } else {
203
18
            block.get_by_position(result).column = std::move(col_to);
204
18
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
8
                        const NullMap::value_type* null_map = nullptr) const override {
144
8
        using ToFieldType = typename ToDataType::FieldType;
145
8
        using FromFieldType = typename FromDataType::FieldType;
146
147
8
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
8
        const auto* col_from =
149
8
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
8
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
8
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
8
        UInt32 from_precision = from_decimal_type.get_precision();
157
8
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
8
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
8
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
8
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
8
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
8
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
8
        const auto& vec_from = col_from->get_data();
170
8
        const auto* vec_from_data = vec_from.data();
171
8
        auto& vec_to = col_to->get_data();
172
8
        auto* vec_to_data = vec_to.data();
173
174
8
        ColumnUInt8::MutablePtr col_null_map_to;
175
8
        NullMap::value_type* null_map_data = nullptr;
176
8
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
8
        CastParameters params;
182
8
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
8
        size_t size = vec_from.size();
184
8
        typename FromFieldType::NativeType scale_multiplier =
185
8
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
584
        for (size_t i = 0; i < size; i++) {
187
576
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
576
                                          typename ToDataType::FieldType>(
189
576
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
576
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
576
        }
198
199
8
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
8
        return Status::OK();
206
8
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
8
                        const NullMap::value_type* null_map = nullptr) const override {
144
8
        using ToFieldType = typename ToDataType::FieldType;
145
8
        using FromFieldType = typename FromDataType::FieldType;
146
147
8
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
8
        const auto* col_from =
149
8
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
8
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
8
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
8
        UInt32 from_precision = from_decimal_type.get_precision();
157
8
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
8
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
8
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
8
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
8
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
8
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
8
        const auto& vec_from = col_from->get_data();
170
8
        const auto* vec_from_data = vec_from.data();
171
8
        auto& vec_to = col_to->get_data();
172
8
        auto* vec_to_data = vec_to.data();
173
174
8
        ColumnUInt8::MutablePtr col_null_map_to;
175
8
        NullMap::value_type* null_map_data = nullptr;
176
8
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
8
        CastParameters params;
182
8
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
8
        size_t size = vec_from.size();
184
8
        typename FromFieldType::NativeType scale_multiplier =
185
8
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
584
        for (size_t i = 0; i < size; i++) {
187
576
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
576
                                          typename ToDataType::FieldType>(
189
576
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
576
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
576
        }
198
199
8
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
8
        } else {
203
8
            block.get_by_position(result).column = std::move(col_to);
204
8
        }
205
8
        return Status::OK();
206
8
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
1.42k
        for (size_t i = 0; i < size; i++) {
187
1.40k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
1.40k
                                          typename ToDataType::FieldType>(
189
1.40k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
1.40k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
1.40k
        }
198
199
18
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
18
        } else {
203
18
            block.get_by_position(result).column = std::move(col_to);
204
18
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
1.42k
        for (size_t i = 0; i < size; i++) {
187
1.40k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
1.40k
                                          typename ToDataType::FieldType>(
189
1.40k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
1.40k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
1.40k
        }
198
199
18
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
18
        } else {
203
18
            block.get_by_position(result).column = std::move(col_to);
204
18
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
6
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
6
            null_map_data = col_null_map_to->get_data().data();
179
6
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
1.24k
        for (size_t i = 0; i < size; i++) {
187
1.22k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
1.22k
                                          typename ToDataType::FieldType>(
189
1.22k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
1.22k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
1.22k
        }
198
199
18
        if (overflow_and_nullable) {
200
6
            block.get_by_position(result).column =
201
6
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
12
        } else {
203
12
            block.get_by_position(result).column = std::move(col_to);
204
12
        }
205
18
        return Status::OK();
206
18
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
18
                        const NullMap::value_type* null_map = nullptr) const override {
144
18
        using ToFieldType = typename ToDataType::FieldType;
145
18
        using FromFieldType = typename FromDataType::FieldType;
146
147
18
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
18
        const auto* col_from =
149
18
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
18
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
18
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
18
        UInt32 from_precision = from_decimal_type.get_precision();
157
18
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
18
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
18
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
161
162
        // may overflow if integer part of decimal is larger than to_max_digits
163
        // in strict mode we also decide nullable on this.
164
18
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
18
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
18
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
18
        const auto& vec_from = col_from->get_data();
170
18
        const auto* vec_from_data = vec_from.data();
171
18
        auto& vec_to = col_to->get_data();
172
18
        auto* vec_to_data = vec_to.data();
173
174
18
        ColumnUInt8::MutablePtr col_null_map_to;
175
18
        NullMap::value_type* null_map_data = nullptr;
176
18
        if (overflow_and_nullable) {
177
6
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
6
            null_map_data = col_null_map_to->get_data().data();
179
6
        }
180
181
18
        CastParameters params;
182
18
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
18
        size_t size = vec_from.size();
184
18
        typename FromFieldType::NativeType scale_multiplier =
185
18
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
1.24k
        for (size_t i = 0; i < size; i++) {
187
1.22k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
1.22k
                                          typename ToDataType::FieldType>(
189
1.22k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
1.22k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
1.22k
        }
198
199
18
        if (overflow_and_nullable) {
200
6
            block.get_by_position(result).column =
201
6
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
12
        } else {
203
12
            block.get_by_position(result).column = std::move(col_to);
204
12
        }
205
18
        return Status::OK();
206
18
    }
207
};
208
209
template <typename T>
210
constexpr static bool int_allow_cast_from_date =
211
        std::is_same_v<T, DataTypeInt32> || std::is_same_v<T, DataTypeInt64> ||
212
        std::is_same_v<T, DataTypeInt128>;
213
214
template <typename T>
215
constexpr static bool int_allow_cast_from_datetime =
216
        std::is_same_v<T, DataTypeInt64> || std::is_same_v<T, DataTypeInt128>;
217
218
// cast from date and datetime to int
219
template <CastModeType CastMode, typename FromDataType, typename ToDataType>
220
    requires(((IsDateType<FromDataType> ||
221
               IsDateV2Type<FromDataType>)&&int_allow_cast_from_date<ToDataType>) ||
222
             ((IsDateTimeType<FromDataType> ||
223
               IsDateTimeV2Type<FromDataType>)&&int_allow_cast_from_datetime<ToDataType>))
224
class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase {
225
public:
226
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
227
                        uint32_t result, size_t input_rows_count,
228
44
                        const NullMap::value_type* null_map = nullptr) const override {
229
44
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
44
                                                                 input_rows_count);
231
44
    }
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_12DataTypeDateENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_12DataTypeDateENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
2
                        const NullMap::value_type* null_map = nullptr) const override {
229
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
2
                                                                 input_rows_count);
231
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
2
                        const NullMap::value_type* null_map = nullptr) const override {
229
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
2
                                                                 input_rows_count);
231
2
    }
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_12DataTypeDateENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_12DataTypeDateENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
2
                        const NullMap::value_type* null_map = nullptr) const override {
229
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
2
                                                                 input_rows_count);
231
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
2
                        const NullMap::value_type* null_map = nullptr) const override {
229
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
2
                                                                 input_rows_count);
231
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_18DataTypeDateTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
8
                        const NullMap::value_type* null_map = nullptr) const override {
229
8
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
8
                                                                 input_rows_count);
231
8
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_18DataTypeDateTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
8
                        const NullMap::value_type* null_map = nullptr) const override {
229
8
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
8
                                                                 input_rows_count);
231
8
    }
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_16DataTypeDateTimeENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_16DataTypeDateTimeENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_12DataTypeDateENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_12DataTypeDateENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
2
                        const NullMap::value_type* null_map = nullptr) const override {
229
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
2
                                                                 input_rows_count);
231
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
2
                        const NullMap::value_type* null_map = nullptr) const override {
229
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
2
                                                                 input_rows_count);
231
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_18DataTypeDateTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
8
                        const NullMap::value_type* null_map = nullptr) const override {
229
8
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
8
                                                                 input_rows_count);
231
8
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_18DataTypeDateTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
8
                        const NullMap::value_type* null_map = nullptr) const override {
229
8
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
8
                                                                 input_rows_count);
231
8
    }
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_16DataTypeDateTimeENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_16DataTypeDateTimeENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
232
};
233
namespace CastWrapper {
234
235
template <typename ToDataType>
236
12.4k
WrapperType create_int_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
237
12.4k
    std::shared_ptr<CastToBase> cast_impl;
238
239
12.4k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
12.4k
        using Types = std::decay_t<decltype(types)>;
241
12.4k
        using FromDataType = typename Types::LeftType;
242
12.4k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
12.4k
            if (context->enable_strict_mode()) {
244
10.0k
                cast_impl = std::make_shared<
245
10.0k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
10.0k
            } else {
247
2.42k
                cast_impl = std::make_shared<
248
2.42k
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2.42k
            }
250
12.4k
            return true;
251
12.4k
        } else {
252
0
            return false;
253
0
        }
254
12.4k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_2EEEvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_4EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
10
                cast_impl = std::make_shared<
245
10
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
10
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_5EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
10
                cast_impl = std::make_shared<
245
10
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
10
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_6EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
10
                cast_impl = std::make_shared<
245
10
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
10
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_7EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
10
                cast_impl = std::make_shared<
245
10
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
10
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_8EEEvEEEEbSS_
Line
Count
Source
239
46
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
46
        using Types = std::decay_t<decltype(types)>;
241
46
        using FromDataType = typename Types::LeftType;
242
46
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
46
            if (context->enable_strict_mode()) {
244
42
                cast_impl = std::make_shared<
245
42
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
42
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
46
            return true;
251
        } else {
252
            return false;
253
        }
254
46
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_9EEEvEEEEbSS_
Line
Count
Source
239
54
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
54
        using Types = std::decay_t<decltype(types)>;
241
54
        using FromDataType = typename Types::LeftType;
242
54
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
54
            if (context->enable_strict_mode()) {
244
50
                cast_impl = std::make_shared<
245
50
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
50
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
54
            return true;
251
        } else {
252
            return false;
253
        }
254
54
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_28EEEvEEEEbSS_
Line
Count
Source
239
28
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
28
        using Types = std::decay_t<decltype(types)>;
241
28
        using FromDataType = typename Types::LeftType;
242
28
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
28
            if (context->enable_strict_mode()) {
244
14
                cast_impl = std::make_shared<
245
14
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
14
            } else {
247
14
                cast_impl = std::make_shared<
248
14
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
14
            }
250
28
            return true;
251
        } else {
252
            return false;
253
        }
254
28
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_29EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_20EEEvEEEEbSS_
Line
Count
Source
239
16
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
16
        using Types = std::decay_t<decltype(types)>;
241
16
        using FromDataType = typename Types::LeftType;
242
16
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
16
            if (context->enable_strict_mode()) {
244
8
                cast_impl = std::make_shared<
245
8
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
8
            } else {
247
8
                cast_impl = std::make_shared<
248
8
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
8
            }
250
16
            return true;
251
        } else {
252
            return false;
253
        }
254
16
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_30EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_35EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_
Line
Count
Source
239
144
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
144
        using Types = std::decay_t<decltype(types)>;
241
144
        using FromDataType = typename Types::LeftType;
242
144
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
144
            if (context->enable_strict_mode()) {
244
72
                cast_impl = std::make_shared<
245
72
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
72
            } else {
247
72
                cast_impl = std::make_shared<
248
72
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
72
            }
250
144
            return true;
251
        } else {
252
            return false;
253
        }
254
144
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_
Line
Count
Source
239
48
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
48
        using Types = std::decay_t<decltype(types)>;
241
48
        using FromDataType = typename Types::LeftType;
242
48
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
48
            if (context->enable_strict_mode()) {
244
24
                cast_impl = std::make_shared<
245
24
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
24
            } else {
247
24
                cast_impl = std::make_shared<
248
24
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
24
            }
250
48
            return true;
251
        } else {
252
            return false;
253
        }
254
48
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_
Line
Count
Source
239
640
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
640
        using Types = std::decay_t<decltype(types)>;
241
640
        using FromDataType = typename Types::LeftType;
242
640
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
640
            if (context->enable_strict_mode()) {
244
320
                cast_impl = std::make_shared<
245
320
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
320
            } else {
247
320
                cast_impl = std::make_shared<
248
320
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
320
            }
250
640
            return true;
251
        } else {
252
            return false;
253
        }
254
640
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_
Line
Count
Source
239
1.71k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
1.71k
        using Types = std::decay_t<decltype(types)>;
241
1.71k
        using FromDataType = typename Types::LeftType;
242
1.71k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
1.71k
            if (context->enable_strict_mode()) {
244
1.66k
                cast_impl = std::make_shared<
245
1.66k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1.66k
            } else {
247
50
                cast_impl = std::make_shared<
248
50
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
50
            }
250
1.71k
            return true;
251
        } else {
252
            return false;
253
        }
254
1.71k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_2EEEvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_3EEEvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_5EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
10
                cast_impl = std::make_shared<
245
10
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
10
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_6EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
10
                cast_impl = std::make_shared<
245
10
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
10
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_7EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
10
                cast_impl = std::make_shared<
245
10
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
10
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_8EEEvEEEEbSS_
Line
Count
Source
239
42
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
42
        using Types = std::decay_t<decltype(types)>;
241
42
        using FromDataType = typename Types::LeftType;
242
42
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
42
            if (context->enable_strict_mode()) {
244
38
                cast_impl = std::make_shared<
245
38
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
38
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
42
            return true;
251
        } else {
252
            return false;
253
        }
254
42
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_9EEEvEEEEbSS_
Line
Count
Source
239
50
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
50
        using Types = std::decay_t<decltype(types)>;
241
50
        using FromDataType = typename Types::LeftType;
242
50
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
50
            if (context->enable_strict_mode()) {
244
46
                cast_impl = std::make_shared<
245
46
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
46
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
50
            return true;
251
        } else {
252
            return false;
253
        }
254
50
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_28EEEvEEEEbSS_
Line
Count
Source
239
28
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
28
        using Types = std::decay_t<decltype(types)>;
241
28
        using FromDataType = typename Types::LeftType;
242
28
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
28
            if (context->enable_strict_mode()) {
244
14
                cast_impl = std::make_shared<
245
14
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
14
            } else {
247
14
                cast_impl = std::make_shared<
248
14
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
14
            }
250
28
            return true;
251
        } else {
252
            return false;
253
        }
254
28
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_29EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_20EEEvEEEEbSS_
Line
Count
Source
239
16
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
16
        using Types = std::decay_t<decltype(types)>;
241
16
        using FromDataType = typename Types::LeftType;
242
16
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
16
            if (context->enable_strict_mode()) {
244
8
                cast_impl = std::make_shared<
245
8
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
8
            } else {
247
8
                cast_impl = std::make_shared<
248
8
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
8
            }
250
16
            return true;
251
        } else {
252
            return false;
253
        }
254
16
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_30EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_35EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_
Line
Count
Source
239
144
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
144
        using Types = std::decay_t<decltype(types)>;
241
144
        using FromDataType = typename Types::LeftType;
242
144
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
144
            if (context->enable_strict_mode()) {
244
72
                cast_impl = std::make_shared<
245
72
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
72
            } else {
247
72
                cast_impl = std::make_shared<
248
72
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
72
            }
250
144
            return true;
251
        } else {
252
            return false;
253
        }
254
144
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_
Line
Count
Source
239
48
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
48
        using Types = std::decay_t<decltype(types)>;
241
48
        using FromDataType = typename Types::LeftType;
242
48
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
48
            if (context->enable_strict_mode()) {
244
24
                cast_impl = std::make_shared<
245
24
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
24
            } else {
247
24
                cast_impl = std::make_shared<
248
24
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
24
            }
250
48
            return true;
251
        } else {
252
            return false;
253
        }
254
48
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_
Line
Count
Source
239
640
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
640
        using Types = std::decay_t<decltype(types)>;
241
640
        using FromDataType = typename Types::LeftType;
242
640
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
640
            if (context->enable_strict_mode()) {
244
320
                cast_impl = std::make_shared<
245
320
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
320
            } else {
247
320
                cast_impl = std::make_shared<
248
320
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
320
            }
250
640
            return true;
251
        } else {
252
            return false;
253
        }
254
640
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_
Line
Count
Source
239
1.68k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
1.68k
        using Types = std::decay_t<decltype(types)>;
241
1.68k
        using FromDataType = typename Types::LeftType;
242
1.68k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
1.68k
            if (context->enable_strict_mode()) {
244
1.63k
                cast_impl = std::make_shared<
245
1.63k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1.63k
            } else {
247
50
                cast_impl = std::make_shared<
248
50
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
50
            }
250
1.68k
            return true;
251
        } else {
252
            return false;
253
        }
254
1.68k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_2EEEvEEEEbSS_
Line
Count
Source
239
8
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
8
        using Types = std::decay_t<decltype(types)>;
241
8
        using FromDataType = typename Types::LeftType;
242
8
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
8
            if (context->enable_strict_mode()) {
244
4
                cast_impl = std::make_shared<
245
4
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
4
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
8
            return true;
251
        } else {
252
            return false;
253
        }
254
8
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_3EEEvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_4EEEvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_6EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
10
                cast_impl = std::make_shared<
245
10
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
10
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_7EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
10
                cast_impl = std::make_shared<
245
10
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
10
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_8EEEvEEEEbSS_
Line
Count
Source
239
34
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
34
        using Types = std::decay_t<decltype(types)>;
241
34
        using FromDataType = typename Types::LeftType;
242
34
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
34
            if (context->enable_strict_mode()) {
244
30
                cast_impl = std::make_shared<
245
30
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
30
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
34
            return true;
251
        } else {
252
            return false;
253
        }
254
34
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_9EEEvEEEEbSS_
Line
Count
Source
239
42
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
42
        using Types = std::decay_t<decltype(types)>;
241
42
        using FromDataType = typename Types::LeftType;
242
42
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
42
            if (context->enable_strict_mode()) {
244
38
                cast_impl = std::make_shared<
245
38
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
38
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
42
            return true;
251
        } else {
252
            return false;
253
        }
254
42
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_28EEEvEEEEbSS_
Line
Count
Source
239
28
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
28
        using Types = std::decay_t<decltype(types)>;
241
28
        using FromDataType = typename Types::LeftType;
242
28
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
28
            if (context->enable_strict_mode()) {
244
14
                cast_impl = std::make_shared<
245
14
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
14
            } else {
247
14
                cast_impl = std::make_shared<
248
14
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
14
            }
250
28
            return true;
251
        } else {
252
            return false;
253
        }
254
28
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_29EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_20EEEvEEEEbSS_
Line
Count
Source
239
16
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
16
        using Types = std::decay_t<decltype(types)>;
241
16
        using FromDataType = typename Types::LeftType;
242
16
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
16
            if (context->enable_strict_mode()) {
244
8
                cast_impl = std::make_shared<
245
8
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
8
            } else {
247
8
                cast_impl = std::make_shared<
248
8
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
8
            }
250
16
            return true;
251
        } else {
252
            return false;
253
        }
254
16
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_30EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_35EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_
Line
Count
Source
239
48
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
48
        using Types = std::decay_t<decltype(types)>;
241
48
        using FromDataType = typename Types::LeftType;
242
48
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
48
            if (context->enable_strict_mode()) {
244
24
                cast_impl = std::make_shared<
245
24
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
24
            } else {
247
24
                cast_impl = std::make_shared<
248
24
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
24
            }
250
48
            return true;
251
        } else {
252
            return false;
253
        }
254
48
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_
Line
Count
Source
239
552
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
552
        using Types = std::decay_t<decltype(types)>;
241
552
        using FromDataType = typename Types::LeftType;
242
552
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
552
            if (context->enable_strict_mode()) {
244
276
                cast_impl = std::make_shared<
245
276
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
276
            } else {
247
276
                cast_impl = std::make_shared<
248
276
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
276
            }
250
552
            return true;
251
        } else {
252
            return false;
253
        }
254
552
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_
Line
Count
Source
239
1.65k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
1.65k
        using Types = std::decay_t<decltype(types)>;
241
1.65k
        using FromDataType = typename Types::LeftType;
242
1.65k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
1.65k
            if (context->enable_strict_mode()) {
244
1.60k
                cast_impl = std::make_shared<
245
1.60k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1.60k
            } else {
247
52
                cast_impl = std::make_shared<
248
52
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
52
            }
250
1.65k
            return true;
251
        } else {
252
            return false;
253
        }
254
1.65k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_2EEEvEEEEbSS_
Line
Count
Source
239
160
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
160
        using Types = std::decay_t<decltype(types)>;
241
160
        using FromDataType = typename Types::LeftType;
242
160
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
160
            if (context->enable_strict_mode()) {
244
4
                cast_impl = std::make_shared<
245
4
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
156
            } else {
247
156
                cast_impl = std::make_shared<
248
156
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
156
            }
250
160
            return true;
251
        } else {
252
            return false;
253
        }
254
160
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_3EEEvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_4EEEvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_5EEEvEEEEbSS_
Line
Count
Source
239
6
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
6
        using Types = std::decay_t<decltype(types)>;
241
6
        using FromDataType = typename Types::LeftType;
242
6
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
6
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
4
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
6
            return true;
251
        } else {
252
            return false;
253
        }
254
6
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_7EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
10
                cast_impl = std::make_shared<
245
10
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
10
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_8EEEvEEEEbSS_
Line
Count
Source
239
26
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
26
        using Types = std::decay_t<decltype(types)>;
241
26
        using FromDataType = typename Types::LeftType;
242
26
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
26
            if (context->enable_strict_mode()) {
244
22
                cast_impl = std::make_shared<
245
22
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
22
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
26
            return true;
251
        } else {
252
            return false;
253
        }
254
26
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_9EEEvEEEEbSS_
Line
Count
Source
239
34
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
34
        using Types = std::decay_t<decltype(types)>;
241
34
        using FromDataType = typename Types::LeftType;
242
34
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
34
            if (context->enable_strict_mode()) {
244
30
                cast_impl = std::make_shared<
245
30
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
30
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
34
            return true;
251
        } else {
252
            return false;
253
        }
254
34
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_28EEEvEEEEbSS_
Line
Count
Source
239
28
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
28
        using Types = std::decay_t<decltype(types)>;
241
28
        using FromDataType = typename Types::LeftType;
242
28
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
28
            if (context->enable_strict_mode()) {
244
14
                cast_impl = std::make_shared<
245
14
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
14
            } else {
247
14
                cast_impl = std::make_shared<
248
14
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
14
            }
250
28
            return true;
251
        } else {
252
            return false;
253
        }
254
28
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_29EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_20EEEvEEEEbSS_
Line
Count
Source
239
16
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
16
        using Types = std::decay_t<decltype(types)>;
241
16
        using FromDataType = typename Types::LeftType;
242
16
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
16
            if (context->enable_strict_mode()) {
244
8
                cast_impl = std::make_shared<
245
8
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
8
            } else {
247
8
                cast_impl = std::make_shared<
248
8
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
8
            }
250
16
            return true;
251
        } else {
252
            return false;
253
        }
254
16
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_30EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_35EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_
Line
Count
Source
239
16
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
16
        using Types = std::decay_t<decltype(types)>;
241
16
        using FromDataType = typename Types::LeftType;
242
16
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
16
            if (context->enable_strict_mode()) {
244
8
                cast_impl = std::make_shared<
245
8
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
8
            } else {
247
8
                cast_impl = std::make_shared<
248
8
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
8
            }
250
16
            return true;
251
        } else {
252
            return false;
253
        }
254
16
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_
Line
Count
Source
239
8
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
8
        using Types = std::decay_t<decltype(types)>;
241
8
        using FromDataType = typename Types::LeftType;
242
8
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
8
            if (context->enable_strict_mode()) {
244
4
                cast_impl = std::make_shared<
245
4
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
4
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
8
            return true;
251
        } else {
252
            return false;
253
        }
254
8
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_
Line
Count
Source
239
1.61k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
1.61k
        using Types = std::decay_t<decltype(types)>;
241
1.61k
        using FromDataType = typename Types::LeftType;
242
1.61k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
1.61k
            if (context->enable_strict_mode()) {
244
1.56k
                cast_impl = std::make_shared<
245
1.56k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1.56k
            } else {
247
50
                cast_impl = std::make_shared<
248
50
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
50
            }
250
1.61k
            return true;
251
        } else {
252
            return false;
253
        }
254
1.61k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_2EEEvEEEEbSS_
Line
Count
Source
239
173
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
173
        using Types = std::decay_t<decltype(types)>;
241
173
        using FromDataType = typename Types::LeftType;
242
173
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
173
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
171
            } else {
247
171
                cast_impl = std::make_shared<
248
171
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
171
            }
250
173
            return true;
251
        } else {
252
            return false;
253
        }
254
173
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_3EEEvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_4EEEvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_5EEEvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_6EEEvEEEEbSS_
Line
Count
Source
239
195
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
195
        using Types = std::decay_t<decltype(types)>;
241
195
        using FromDataType = typename Types::LeftType;
242
195
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
195
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
193
            } else {
247
193
                cast_impl = std::make_shared<
248
193
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
193
            }
250
195
            return true;
251
        } else {
252
            return false;
253
        }
254
195
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_8EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
14
                cast_impl = std::make_shared<
245
14
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
14
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_9EEEvEEEEbSS_
Line
Count
Source
239
26
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
26
        using Types = std::decay_t<decltype(types)>;
241
26
        using FromDataType = typename Types::LeftType;
242
26
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
26
            if (context->enable_strict_mode()) {
244
22
                cast_impl = std::make_shared<
245
22
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
22
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
26
            return true;
251
        } else {
252
            return false;
253
        }
254
26
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_28EEEvEEEEbSS_
Line
Count
Source
239
28
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
28
        using Types = std::decay_t<decltype(types)>;
241
28
        using FromDataType = typename Types::LeftType;
242
28
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
28
            if (context->enable_strict_mode()) {
244
14
                cast_impl = std::make_shared<
245
14
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
14
            } else {
247
14
                cast_impl = std::make_shared<
248
14
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
14
            }
250
28
            return true;
251
        } else {
252
            return false;
253
        }
254
28
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_29EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_20EEEvEEEEbSS_
Line
Count
Source
239
16
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
16
        using Types = std::decay_t<decltype(types)>;
241
16
        using FromDataType = typename Types::LeftType;
242
16
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
16
            if (context->enable_strict_mode()) {
244
8
                cast_impl = std::make_shared<
245
8
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
8
            } else {
247
8
                cast_impl = std::make_shared<
248
8
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
8
            }
250
16
            return true;
251
        } else {
252
            return false;
253
        }
254
16
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_30EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_35EEEvEEEEbSS_
Line
Count
Source
239
36
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
36
        using Types = std::decay_t<decltype(types)>;
241
36
        using FromDataType = typename Types::LeftType;
242
36
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
36
            if (context->enable_strict_mode()) {
244
18
                cast_impl = std::make_shared<
245
18
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
18
            } else {
247
18
                cast_impl = std::make_shared<
248
18
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
18
            }
250
36
            return true;
251
        } else {
252
            return false;
253
        }
254
36
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_
Line
Count
Source
239
16
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
16
        using Types = std::decay_t<decltype(types)>;
241
16
        using FromDataType = typename Types::LeftType;
242
16
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
16
            if (context->enable_strict_mode()) {
244
8
                cast_impl = std::make_shared<
245
8
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
8
            } else {
247
8
                cast_impl = std::make_shared<
248
8
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
8
            }
250
16
            return true;
251
        } else {
252
            return false;
253
        }
254
16
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_
Line
Count
Source
239
8
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
8
        using Types = std::decay_t<decltype(types)>;
241
8
        using FromDataType = typename Types::LeftType;
242
8
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
8
            if (context->enable_strict_mode()) {
244
4
                cast_impl = std::make_shared<
245
4
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
4
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
8
            return true;
251
        } else {
252
            return false;
253
        }
254
8
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_
Line
Count
Source
239
1.58k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
1.58k
        using Types = std::decay_t<decltype(types)>;
241
1.58k
        using FromDataType = typename Types::LeftType;
242
1.58k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
1.58k
            if (context->enable_strict_mode()) {
244
1.53k
                cast_impl = std::make_shared<
245
1.53k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1.53k
            } else {
247
50
                cast_impl = std::make_shared<
248
50
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
50
            }
250
1.58k
            return true;
251
        } else {
252
            return false;
253
        }
254
1.58k
    };
255
256
12.4k
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) {
257
0
        return create_unsupport_wrapper(
258
0
                fmt::format("CAST AS number not supported {}", from_type->get_name()));
259
0
    }
260
261
12.4k
    return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
262
12.4k
                       uint32_t result, size_t input_rows_count,
263
12.4k
                       const NullMap::value_type* null_map = nullptr) {
264
12.4k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
12.4k
                                       null_map);
266
12.4k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_
Line
Count
Source
263
2.85k
                       const NullMap::value_type* null_map = nullptr) {
264
2.85k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
2.85k
                                       null_map);
266
2.85k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_
Line
Count
Source
263
2.80k
                       const NullMap::value_type* null_map = nullptr) {
264
2.80k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
2.80k
                                       null_map);
266
2.80k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_
Line
Count
Source
263
2.52k
                       const NullMap::value_type* null_map = nullptr) {
264
2.52k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
2.52k
                                       null_map);
266
2.52k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_
Line
Count
Source
263
2.04k
                       const NullMap::value_type* null_map = nullptr) {
264
2.04k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
2.04k
                                       null_map);
266
2.04k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_
Line
Count
Source
263
2.19k
                       const NullMap::value_type* null_map = nullptr) {
264
2.19k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
2.19k
                                       null_map);
266
2.19k
    };
267
12.4k
}
_ZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE
Line
Count
Source
236
2.85k
WrapperType create_int_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
237
2.85k
    std::shared_ptr<CastToBase> cast_impl;
238
239
2.85k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2.85k
        using Types = std::decay_t<decltype(types)>;
241
2.85k
        using FromDataType = typename Types::LeftType;
242
2.85k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2.85k
            if (context->enable_strict_mode()) {
244
2.85k
                cast_impl = std::make_shared<
245
2.85k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2.85k
            } else {
247
2.85k
                cast_impl = std::make_shared<
248
2.85k
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2.85k
            }
250
2.85k
            return true;
251
2.85k
        } else {
252
2.85k
            return false;
253
2.85k
        }
254
2.85k
    };
255
256
2.85k
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) {
257
0
        return create_unsupport_wrapper(
258
0
                fmt::format("CAST AS number not supported {}", from_type->get_name()));
259
0
    }
260
261
2.85k
    return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
262
2.85k
                       uint32_t result, size_t input_rows_count,
263
2.85k
                       const NullMap::value_type* null_map = nullptr) {
264
2.85k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
2.85k
                                       null_map);
266
2.85k
    };
267
2.85k
}
_ZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE
Line
Count
Source
236
2.80k
WrapperType create_int_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
237
2.80k
    std::shared_ptr<CastToBase> cast_impl;
238
239
2.80k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2.80k
        using Types = std::decay_t<decltype(types)>;
241
2.80k
        using FromDataType = typename Types::LeftType;
242
2.80k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2.80k
            if (context->enable_strict_mode()) {
244
2.80k
                cast_impl = std::make_shared<
245
2.80k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2.80k
            } else {
247
2.80k
                cast_impl = std::make_shared<
248
2.80k
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2.80k
            }
250
2.80k
            return true;
251
2.80k
        } else {
252
2.80k
            return false;
253
2.80k
        }
254
2.80k
    };
255
256
2.80k
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) {
257
0
        return create_unsupport_wrapper(
258
0
                fmt::format("CAST AS number not supported {}", from_type->get_name()));
259
0
    }
260
261
2.80k
    return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
262
2.80k
                       uint32_t result, size_t input_rows_count,
263
2.80k
                       const NullMap::value_type* null_map = nullptr) {
264
2.80k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
2.80k
                                       null_map);
266
2.80k
    };
267
2.80k
}
_ZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE
Line
Count
Source
236
2.52k
WrapperType create_int_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
237
2.52k
    std::shared_ptr<CastToBase> cast_impl;
238
239
2.52k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2.52k
        using Types = std::decay_t<decltype(types)>;
241
2.52k
        using FromDataType = typename Types::LeftType;
242
2.52k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2.52k
            if (context->enable_strict_mode()) {
244
2.52k
                cast_impl = std::make_shared<
245
2.52k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2.52k
            } else {
247
2.52k
                cast_impl = std::make_shared<
248
2.52k
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2.52k
            }
250
2.52k
            return true;
251
2.52k
        } else {
252
2.52k
            return false;
253
2.52k
        }
254
2.52k
    };
255
256
2.52k
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) {
257
0
        return create_unsupport_wrapper(
258
0
                fmt::format("CAST AS number not supported {}", from_type->get_name()));
259
0
    }
260
261
2.52k
    return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
262
2.52k
                       uint32_t result, size_t input_rows_count,
263
2.52k
                       const NullMap::value_type* null_map = nullptr) {
264
2.52k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
2.52k
                                       null_map);
266
2.52k
    };
267
2.52k
}
_ZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE
Line
Count
Source
236
2.04k
WrapperType create_int_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
237
2.04k
    std::shared_ptr<CastToBase> cast_impl;
238
239
2.04k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2.04k
        using Types = std::decay_t<decltype(types)>;
241
2.04k
        using FromDataType = typename Types::LeftType;
242
2.04k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2.04k
            if (context->enable_strict_mode()) {
244
2.04k
                cast_impl = std::make_shared<
245
2.04k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2.04k
            } else {
247
2.04k
                cast_impl = std::make_shared<
248
2.04k
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2.04k
            }
250
2.04k
            return true;
251
2.04k
        } else {
252
2.04k
            return false;
253
2.04k
        }
254
2.04k
    };
255
256
2.04k
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) {
257
0
        return create_unsupport_wrapper(
258
0
                fmt::format("CAST AS number not supported {}", from_type->get_name()));
259
0
    }
260
261
2.04k
    return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
262
2.04k
                       uint32_t result, size_t input_rows_count,
263
2.04k
                       const NullMap::value_type* null_map = nullptr) {
264
2.04k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
2.04k
                                       null_map);
266
2.04k
    };
267
2.04k
}
_ZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE
Line
Count
Source
236
2.19k
WrapperType create_int_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
237
2.19k
    std::shared_ptr<CastToBase> cast_impl;
238
239
2.19k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2.19k
        using Types = std::decay_t<decltype(types)>;
241
2.19k
        using FromDataType = typename Types::LeftType;
242
2.19k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2.19k
            if (context->enable_strict_mode()) {
244
2.19k
                cast_impl = std::make_shared<
245
2.19k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2.19k
            } else {
247
2.19k
                cast_impl = std::make_shared<
248
2.19k
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2.19k
            }
250
2.19k
            return true;
251
2.19k
        } else {
252
2.19k
            return false;
253
2.19k
        }
254
2.19k
    };
255
256
2.19k
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) {
257
0
        return create_unsupport_wrapper(
258
0
                fmt::format("CAST AS number not supported {}", from_type->get_name()));
259
0
    }
260
261
2.19k
    return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
262
2.19k
                       uint32_t result, size_t input_rows_count,
263
2.19k
                       const NullMap::value_type* null_map = nullptr) {
264
2.19k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
2.19k
                                       null_map);
266
2.19k
    };
267
2.19k
}
268
} // namespace CastWrapper
269
#include "common/compile_check_end.h"
270
} // namespace doris