Coverage Report

Created: 2026-03-22 09:54

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/function/cast/function_cast.cpp
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
#include <utility>
19
20
#include "core/data_type/data_type_agg_state.h"
21
#include "core/data_type/data_type_decimal.h"
22
#include "core/data_type/data_type_number.h" // IWYU pragma: keep
23
#include "core/data_type/data_type_quantilestate.h"
24
#include "core/data_type/primitive_type.h"
25
#include "exprs/function/cast/cast_to_array.h"
26
#include "exprs/function/cast/cast_to_jsonb.h"
27
#include "exprs/function/cast/cast_to_map.h"
28
#include "exprs/function/cast/cast_to_struct.h"
29
#include "exprs/function/cast/cast_to_variant.h"
30
#include "exprs/function/cast/cast_wrapper_decls.h"
31
#include "exprs/function/simple_function_factory.h"
32
33
namespace doris {
34
35
namespace CastWrapper {
36
37
WrapperType create_hll_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
38
6
                               const DataTypeHLL& to_type) {
39
    /// Conversion from String through parsing.
40
6
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
41
6
        return cast_from_string_to_generic;
42
6
    }
43
44
0
    return CastWrapper::create_unsupport_wrapper("Cast to HLL only support from String type");
45
6
}
46
47
WrapperType create_bitmap_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
48
5
                                  const DataTypeBitMap& to_type) {
49
    /// Conversion from String through parsing.
50
5
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
51
5
        return cast_from_string_to_generic;
52
5
    }
53
54
0
    return CastWrapper::create_unsupport_wrapper("Cast to BitMap only support from String type");
55
5
}
56
57
WrapperType create_quantile_state_wrapper(FunctionContext* context,
58
                                          const DataTypePtr& from_type_untyped,
59
2
                                          const DataTypeQuantileState& to_type) {
60
    /// Conversion from String through parsing.
61
2
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
62
2
        return cast_from_string_to_generic;
63
2
    }
64
65
0
    return CastWrapper::create_unsupport_wrapper(
66
0
            "Cast to QuantileState only support from String type");
67
2
}
68
69
2
WrapperType create_varbinary_wrapper(const DataTypePtr& from_type_untyped) {
70
    /// Conversion from String through parsing.
71
2
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
72
2
        return cast_from_string_to_generic;
73
2
    }
74
75
0
    return CastWrapper::create_unsupport_wrapper("Cast to Varbinary only support from String type");
76
2
}
77
78
WrapperType prepare_unpack_dictionaries(FunctionContext* context, const DataTypePtr& from_type,
79
427k
                                        const DataTypePtr& to_type) {
80
427k
    const auto& from_nested = from_type;
81
427k
    const auto& to_nested = to_type;
82
83
427k
    if (from_type->is_null_literal()) {
84
2.13k
        if (!to_nested->is_nullable()) {
85
0
            return CastWrapper::create_unsupport_wrapper(
86
0
                    "Cannot convert NULL to a non-nullable type");
87
0
        }
88
89
2.13k
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
90
2.13k
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
91
            /// TODO: remove this in the future.
92
2.13k
            auto& res = block.get_by_position(result);
93
2.13k
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
94
2.13k
                                 ->convert_to_full_column_if_const();
95
2.13k
            return Status::OK();
96
2.13k
        };
97
2.13k
    }
98
99
425k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
100
101
425k
    return wrapper;
102
427k
}
103
104
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
105
395k
                                       const DataTypePtr& to_type) {
106
395k
    if (from_type->equals(*to_type)) {
107
70.5k
        return false;
108
70.5k
    }
109
110
324k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
236k
        using Types = std::decay_t<decltype(types)>;
112
236k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
38.7k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
38.7k
            return false;
118
38.7k
        }
119
0
        return call_on_index_and_data_type<
120
236k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
179k
            using Types2 = std::decay_t<decltype(types2)>;
122
179k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
87.6k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
87.6k
                return false;
127
87.6k
            }
128
62.7k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
62.7k
                using FromFieldType = typename FromDataType::FieldType;
130
62.7k
                using ToFieldType = typename ToDataType::FieldType;
131
62.7k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
62.7k
                UInt32 from_scale = 0;
133
134
62.7k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
30.6k
                    const auto* from_decimal_type =
136
30.6k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
30.6k
                    from_precision =
138
30.6k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
30.6k
                    from_scale = from_decimal_type->get_scale();
140
30.6k
                }
141
142
62.7k
                UInt32 to_max_digits = 0;
143
62.7k
                UInt32 to_precision = 0;
144
62.7k
                UInt32 to_scale = 0;
145
146
62.7k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
56.5k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
56.5k
                    const auto* to_decimal_type =
150
56.5k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
56.5k
                    to_precision = to_decimal_type->get_precision();
152
56.5k
                    ToDataType::check_type_precision(to_precision);
153
154
56.5k
                    to_scale = to_decimal_type->get_scale();
155
56.5k
                    ToDataType::check_type_scale(to_scale);
156
56.5k
                }
157
62.7k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
6.11k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
6.11k
                    to_precision = to_max_digits;
160
6.11k
                }
161
162
62.7k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
62.7k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
62.7k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
62.7k
                if (to_scale > from_scale) {
167
12.5k
                    multiply_may_overflow &=
168
12.5k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
12.5k
                }
170
62.7k
                return narrow_integral || multiply_may_overflow;
171
62.7k
            }
172
0
            return false;
173
179k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
23
            using Types2 = std::decay_t<decltype(types2)>;
122
23
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
23
            return false;
173
23
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
120
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
14
            using Types2 = std::decay_t<decltype(types2)>;
122
14
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
14
            return false;
173
14
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
120
31
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
31
            using Types2 = std::decay_t<decltype(types2)>;
122
31
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
31
            return false;
173
31
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
120
97
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
97
            using Types2 = std::decay_t<decltype(types2)>;
122
97
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
97
            return false;
173
97
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
120
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7
            using Types2 = std::decay_t<decltype(types2)>;
122
7
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
7
            return false;
173
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
120
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2
            using Types2 = std::decay_t<decltype(types2)>;
122
2
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
2
            return false;
173
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7
            using Types2 = std::decay_t<decltype(types2)>;
122
7
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
7
            return false;
173
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
120
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
10
            using Types2 = std::decay_t<decltype(types2)>;
122
10
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
10
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
10
                using FromFieldType = typename FromDataType::FieldType;
130
10
                using ToFieldType = typename ToDataType::FieldType;
131
10
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
10
                UInt32 from_scale = 0;
133
134
10
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
10
                    const auto* from_decimal_type =
136
10
                            check_and_get_data_type<FromDataType>(from_type.get());
137
10
                    from_precision =
138
10
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
10
                    from_scale = from_decimal_type->get_scale();
140
10
                }
141
142
10
                UInt32 to_max_digits = 0;
143
10
                UInt32 to_precision = 0;
144
10
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
10
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
10
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
10
                    to_precision = to_max_digits;
160
10
                }
161
162
10
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
10
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
10
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
10
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
10
                return narrow_integral || multiply_may_overflow;
171
10
            }
172
0
            return false;
173
10
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
120
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
5
            using Types2 = std::decay_t<decltype(types2)>;
122
5
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
5
                using FromFieldType = typename FromDataType::FieldType;
130
5
                using ToFieldType = typename ToDataType::FieldType;
131
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
5
                UInt32 from_scale = 0;
133
134
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
5
                    const auto* from_decimal_type =
136
5
                            check_and_get_data_type<FromDataType>(from_type.get());
137
5
                    from_precision =
138
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
5
                    from_scale = from_decimal_type->get_scale();
140
5
                }
141
142
5
                UInt32 to_max_digits = 0;
143
5
                UInt32 to_precision = 0;
144
5
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
5
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
5
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
5
                    to_precision = to_max_digits;
160
5
                }
161
162
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
5
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
5
                return narrow_integral || multiply_may_overflow;
171
5
            }
172
0
            return false;
173
5
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
120
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2
            using Types2 = std::decay_t<decltype(types2)>;
122
2
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
2
                using FromFieldType = typename FromDataType::FieldType;
130
2
                using ToFieldType = typename ToDataType::FieldType;
131
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
2
                UInt32 from_scale = 0;
133
134
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
2
                    const auto* from_decimal_type =
136
2
                            check_and_get_data_type<FromDataType>(from_type.get());
137
2
                    from_precision =
138
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
2
                    from_scale = from_decimal_type->get_scale();
140
2
                }
141
142
2
                UInt32 to_max_digits = 0;
143
2
                UInt32 to_precision = 0;
144
2
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
2
                    to_precision = to_max_digits;
160
2
                }
161
162
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
2
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
2
                return narrow_integral || multiply_may_overflow;
171
2
            }
172
0
            return false;
173
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
120
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
5
            using Types2 = std::decay_t<decltype(types2)>;
122
5
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
5
                using FromFieldType = typename FromDataType::FieldType;
130
5
                using ToFieldType = typename ToDataType::FieldType;
131
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
5
                UInt32 from_scale = 0;
133
134
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
5
                    const auto* from_decimal_type =
136
5
                            check_and_get_data_type<FromDataType>(from_type.get());
137
5
                    from_precision =
138
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
5
                    from_scale = from_decimal_type->get_scale();
140
5
                }
141
142
5
                UInt32 to_max_digits = 0;
143
5
                UInt32 to_precision = 0;
144
5
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
5
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
5
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
5
                    to_precision = to_max_digits;
160
5
                }
161
162
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
5
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
5
                return narrow_integral || multiply_may_overflow;
171
5
            }
172
0
            return false;
173
5
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
120
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2
            using Types2 = std::decay_t<decltype(types2)>;
122
2
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
2
                using FromFieldType = typename FromDataType::FieldType;
130
2
                using ToFieldType = typename ToDataType::FieldType;
131
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
2
                UInt32 from_scale = 0;
133
134
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
2
                    const auto* from_decimal_type =
136
2
                            check_and_get_data_type<FromDataType>(from_type.get());
137
2
                    from_precision =
138
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
2
                    from_scale = from_decimal_type->get_scale();
140
2
                }
141
142
2
                UInt32 to_max_digits = 0;
143
2
                UInt32 to_precision = 0;
144
2
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
2
                    to_precision = to_max_digits;
160
2
                }
161
162
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
2
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
2
                return narrow_integral || multiply_may_overflow;
171
2
            }
172
0
            return false;
173
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
120
770
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
770
            using Types2 = std::decay_t<decltype(types2)>;
122
770
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
770
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
770
                return false;
127
770
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
770
            return false;
173
770
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
120
782
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
782
            using Types2 = std::decay_t<decltype(types2)>;
122
782
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
782
            return false;
173
782
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
120
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
10
            using Types2 = std::decay_t<decltype(types2)>;
122
10
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
10
            return false;
173
10
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
120
143
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
143
            using Types2 = std::decay_t<decltype(types2)>;
122
143
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
143
            return false;
173
143
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
120
273
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
273
            using Types2 = std::decay_t<decltype(types2)>;
122
273
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
273
            return false;
173
273
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
120
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7
            using Types2 = std::decay_t<decltype(types2)>;
122
7
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
7
            return false;
173
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
120
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
23
            using Types2 = std::decay_t<decltype(types2)>;
122
23
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
23
            return false;
173
23
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
30
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
30
            using Types2 = std::decay_t<decltype(types2)>;
122
30
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
30
            return false;
173
30
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
120
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
20
            using Types2 = std::decay_t<decltype(types2)>;
122
20
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
20
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
20
                using FromFieldType = typename FromDataType::FieldType;
130
20
                using ToFieldType = typename ToDataType::FieldType;
131
20
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
20
                UInt32 from_scale = 0;
133
134
20
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
20
                    const auto* from_decimal_type =
136
20
                            check_and_get_data_type<FromDataType>(from_type.get());
137
20
                    from_precision =
138
20
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
20
                    from_scale = from_decimal_type->get_scale();
140
20
                }
141
142
20
                UInt32 to_max_digits = 0;
143
20
                UInt32 to_precision = 0;
144
20
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
20
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
20
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
20
                    to_precision = to_max_digits;
160
20
                }
161
162
20
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
20
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
20
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
20
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
20
                return narrow_integral || multiply_may_overflow;
171
20
            }
172
0
            return false;
173
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
120
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
25
            using Types2 = std::decay_t<decltype(types2)>;
122
25
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
25
                using FromFieldType = typename FromDataType::FieldType;
130
25
                using ToFieldType = typename ToDataType::FieldType;
131
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
25
                UInt32 from_scale = 0;
133
134
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
25
                    const auto* from_decimal_type =
136
25
                            check_and_get_data_type<FromDataType>(from_type.get());
137
25
                    from_precision =
138
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
25
                    from_scale = from_decimal_type->get_scale();
140
25
                }
141
142
25
                UInt32 to_max_digits = 0;
143
25
                UInt32 to_precision = 0;
144
25
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
25
                    to_precision = to_max_digits;
160
25
                }
161
162
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
25
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
25
                return narrow_integral || multiply_may_overflow;
171
25
            }
172
0
            return false;
173
25
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
120
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
8
            using Types2 = std::decay_t<decltype(types2)>;
122
8
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
8
                using FromFieldType = typename FromDataType::FieldType;
130
8
                using ToFieldType = typename ToDataType::FieldType;
131
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
8
                UInt32 from_scale = 0;
133
134
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
8
                    const auto* from_decimal_type =
136
8
                            check_and_get_data_type<FromDataType>(from_type.get());
137
8
                    from_precision =
138
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
8
                    from_scale = from_decimal_type->get_scale();
140
8
                }
141
142
8
                UInt32 to_max_digits = 0;
143
8
                UInt32 to_precision = 0;
144
8
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
8
                    to_precision = to_max_digits;
160
8
                }
161
162
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
8
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
8
                return narrow_integral || multiply_may_overflow;
171
8
            }
172
0
            return false;
173
8
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
120
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
25
            using Types2 = std::decay_t<decltype(types2)>;
122
25
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
25
                using FromFieldType = typename FromDataType::FieldType;
130
25
                using ToFieldType = typename ToDataType::FieldType;
131
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
25
                UInt32 from_scale = 0;
133
134
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
25
                    const auto* from_decimal_type =
136
25
                            check_and_get_data_type<FromDataType>(from_type.get());
137
25
                    from_precision =
138
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
25
                    from_scale = from_decimal_type->get_scale();
140
25
                }
141
142
25
                UInt32 to_max_digits = 0;
143
25
                UInt32 to_precision = 0;
144
25
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
25
                    to_precision = to_max_digits;
160
25
                }
161
162
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
25
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
25
                return narrow_integral || multiply_may_overflow;
171
25
            }
172
0
            return false;
173
25
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
120
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
24
            using Types2 = std::decay_t<decltype(types2)>;
122
24
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
24
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
24
                using FromFieldType = typename FromDataType::FieldType;
130
24
                using ToFieldType = typename ToDataType::FieldType;
131
24
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
24
                UInt32 from_scale = 0;
133
134
24
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
24
                    const auto* from_decimal_type =
136
24
                            check_and_get_data_type<FromDataType>(from_type.get());
137
24
                    from_precision =
138
24
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
24
                    from_scale = from_decimal_type->get_scale();
140
24
                }
141
142
24
                UInt32 to_max_digits = 0;
143
24
                UInt32 to_precision = 0;
144
24
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
24
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
24
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
24
                    to_precision = to_max_digits;
160
24
                }
161
162
24
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
24
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
24
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
24
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
24
                return narrow_integral || multiply_may_overflow;
171
24
            }
172
0
            return false;
173
24
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
120
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
72
            using Types2 = std::decay_t<decltype(types2)>;
122
72
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
72
            return false;
173
72
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
120
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
24
            using Types2 = std::decay_t<decltype(types2)>;
122
24
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
24
            return false;
173
24
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
120
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
320
            using Types2 = std::decay_t<decltype(types2)>;
122
320
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
320
            return false;
173
320
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
120
3.11k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
3.11k
            using Types2 = std::decay_t<decltype(types2)>;
122
3.11k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
3.11k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
3.11k
                return false;
127
3.11k
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
3.11k
            return false;
173
3.11k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
120
136
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
136
            using Types2 = std::decay_t<decltype(types2)>;
122
136
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
136
            return false;
173
136
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
2.05k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2.05k
            using Types2 = std::decay_t<decltype(types2)>;
122
2.05k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
2.05k
            return false;
173
2.05k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
120
161
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
161
            using Types2 = std::decay_t<decltype(types2)>;
122
161
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
161
            return false;
173
161
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
120
100
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
100
            using Types2 = std::decay_t<decltype(types2)>;
122
100
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
100
            return false;
173
100
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
120
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
20
            using Types2 = std::decay_t<decltype(types2)>;
122
20
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
20
            return false;
173
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
120
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
21
            using Types2 = std::decay_t<decltype(types2)>;
122
21
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
21
            return false;
173
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
25
            using Types2 = std::decay_t<decltype(types2)>;
122
25
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
25
            return false;
173
25
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
120
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
23
            using Types2 = std::decay_t<decltype(types2)>;
122
23
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
23
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
23
                using FromFieldType = typename FromDataType::FieldType;
130
23
                using ToFieldType = typename ToDataType::FieldType;
131
23
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
23
                UInt32 from_scale = 0;
133
134
23
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
23
                    const auto* from_decimal_type =
136
23
                            check_and_get_data_type<FromDataType>(from_type.get());
137
23
                    from_precision =
138
23
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
23
                    from_scale = from_decimal_type->get_scale();
140
23
                }
141
142
23
                UInt32 to_max_digits = 0;
143
23
                UInt32 to_precision = 0;
144
23
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
23
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
23
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
23
                    to_precision = to_max_digits;
160
23
                }
161
162
23
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
23
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
23
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
23
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
23
                return narrow_integral || multiply_may_overflow;
171
23
            }
172
0
            return false;
173
23
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
120
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
25
            using Types2 = std::decay_t<decltype(types2)>;
122
25
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
25
                using FromFieldType = typename FromDataType::FieldType;
130
25
                using ToFieldType = typename ToDataType::FieldType;
131
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
25
                UInt32 from_scale = 0;
133
134
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
25
                    const auto* from_decimal_type =
136
25
                            check_and_get_data_type<FromDataType>(from_type.get());
137
25
                    from_precision =
138
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
25
                    from_scale = from_decimal_type->get_scale();
140
25
                }
141
142
25
                UInt32 to_max_digits = 0;
143
25
                UInt32 to_precision = 0;
144
25
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
25
                    to_precision = to_max_digits;
160
25
                }
161
162
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
25
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
25
                return narrow_integral || multiply_may_overflow;
171
25
            }
172
0
            return false;
173
25
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
120
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
8
            using Types2 = std::decay_t<decltype(types2)>;
122
8
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
8
                using FromFieldType = typename FromDataType::FieldType;
130
8
                using ToFieldType = typename ToDataType::FieldType;
131
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
8
                UInt32 from_scale = 0;
133
134
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
8
                    const auto* from_decimal_type =
136
8
                            check_and_get_data_type<FromDataType>(from_type.get());
137
8
                    from_precision =
138
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
8
                    from_scale = from_decimal_type->get_scale();
140
8
                }
141
142
8
                UInt32 to_max_digits = 0;
143
8
                UInt32 to_precision = 0;
144
8
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
8
                    to_precision = to_max_digits;
160
8
                }
161
162
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
8
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
8
                return narrow_integral || multiply_may_overflow;
171
8
            }
172
0
            return false;
173
8
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
120
26
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
26
            using Types2 = std::decay_t<decltype(types2)>;
122
26
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
26
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
26
                using FromFieldType = typename FromDataType::FieldType;
130
26
                using ToFieldType = typename ToDataType::FieldType;
131
26
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
26
                UInt32 from_scale = 0;
133
134
26
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
26
                    const auto* from_decimal_type =
136
26
                            check_and_get_data_type<FromDataType>(from_type.get());
137
26
                    from_precision =
138
26
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
26
                    from_scale = from_decimal_type->get_scale();
140
26
                }
141
142
26
                UInt32 to_max_digits = 0;
143
26
                UInt32 to_precision = 0;
144
26
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
26
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
26
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
26
                    to_precision = to_max_digits;
160
26
                }
161
162
26
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
26
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
26
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
26
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
26
                return narrow_integral || multiply_may_overflow;
171
26
            }
172
0
            return false;
173
26
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
120
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
25
            using Types2 = std::decay_t<decltype(types2)>;
122
25
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
25
                using FromFieldType = typename FromDataType::FieldType;
130
25
                using ToFieldType = typename ToDataType::FieldType;
131
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
25
                UInt32 from_scale = 0;
133
134
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
25
                    const auto* from_decimal_type =
136
25
                            check_and_get_data_type<FromDataType>(from_type.get());
137
25
                    from_precision =
138
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
25
                    from_scale = from_decimal_type->get_scale();
140
25
                }
141
142
25
                UInt32 to_max_digits = 0;
143
25
                UInt32 to_precision = 0;
144
25
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
25
                    to_precision = to_max_digits;
160
25
                }
161
162
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
25
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
25
                return narrow_integral || multiply_may_overflow;
171
25
            }
172
0
            return false;
173
25
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
120
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
72
            using Types2 = std::decay_t<decltype(types2)>;
122
72
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
72
            return false;
173
72
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
120
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
24
            using Types2 = std::decay_t<decltype(types2)>;
122
24
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
24
            return false;
173
24
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
120
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
320
            using Types2 = std::decay_t<decltype(types2)>;
122
320
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
320
            return false;
173
320
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
120
2.49k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2.49k
            using Types2 = std::decay_t<decltype(types2)>;
122
2.49k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
2.49k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
2.49k
                return false;
127
2.49k
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
2.49k
            return false;
173
2.49k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
120
42
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
42
            using Types2 = std::decay_t<decltype(types2)>;
122
42
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
42
            return false;
173
42
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
3.52k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
3.52k
            using Types2 = std::decay_t<decltype(types2)>;
122
3.52k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
3.52k
            return false;
173
3.52k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
120
402
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
402
            using Types2 = std::decay_t<decltype(types2)>;
122
402
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
402
            return false;
173
402
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
120
1.49k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.49k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.49k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
1.49k
            return false;
173
1.49k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
120
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
13
            using Types2 = std::decay_t<decltype(types2)>;
122
13
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
13
            return false;
173
13
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
120
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
20
            using Types2 = std::decay_t<decltype(types2)>;
122
20
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
20
            return false;
173
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
130
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
130
            using Types2 = std::decay_t<decltype(types2)>;
122
130
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
130
            return false;
173
130
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
120
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
21
            using Types2 = std::decay_t<decltype(types2)>;
122
21
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
21
                using FromFieldType = typename FromDataType::FieldType;
130
21
                using ToFieldType = typename ToDataType::FieldType;
131
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
21
                UInt32 from_scale = 0;
133
134
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
21
                    const auto* from_decimal_type =
136
21
                            check_and_get_data_type<FromDataType>(from_type.get());
137
21
                    from_precision =
138
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
21
                    from_scale = from_decimal_type->get_scale();
140
21
                }
141
142
21
                UInt32 to_max_digits = 0;
143
21
                UInt32 to_precision = 0;
144
21
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
21
                    to_precision = to_max_digits;
160
21
                }
161
162
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
21
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
21
                return narrow_integral || multiply_may_overflow;
171
21
            }
172
0
            return false;
173
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
120
38
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
38
            using Types2 = std::decay_t<decltype(types2)>;
122
38
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
38
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
38
                using FromFieldType = typename FromDataType::FieldType;
130
38
                using ToFieldType = typename ToDataType::FieldType;
131
38
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
38
                UInt32 from_scale = 0;
133
134
38
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
38
                    const auto* from_decimal_type =
136
38
                            check_and_get_data_type<FromDataType>(from_type.get());
137
38
                    from_precision =
138
38
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
38
                    from_scale = from_decimal_type->get_scale();
140
38
                }
141
142
38
                UInt32 to_max_digits = 0;
143
38
                UInt32 to_precision = 0;
144
38
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
38
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
38
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
38
                    to_precision = to_max_digits;
160
38
                }
161
162
38
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
38
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
38
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
38
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
38
                return narrow_integral || multiply_may_overflow;
171
38
            }
172
0
            return false;
173
38
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
120
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
8
            using Types2 = std::decay_t<decltype(types2)>;
122
8
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
8
                using FromFieldType = typename FromDataType::FieldType;
130
8
                using ToFieldType = typename ToDataType::FieldType;
131
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
8
                UInt32 from_scale = 0;
133
134
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
8
                    const auto* from_decimal_type =
136
8
                            check_and_get_data_type<FromDataType>(from_type.get());
137
8
                    from_precision =
138
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
8
                    from_scale = from_decimal_type->get_scale();
140
8
                }
141
142
8
                UInt32 to_max_digits = 0;
143
8
                UInt32 to_precision = 0;
144
8
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
8
                    to_precision = to_max_digits;
160
8
                }
161
162
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
8
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
8
                return narrow_integral || multiply_may_overflow;
171
8
            }
172
0
            return false;
173
8
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
120
250
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
250
            using Types2 = std::decay_t<decltype(types2)>;
122
250
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
250
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
250
                using FromFieldType = typename FromDataType::FieldType;
130
250
                using ToFieldType = typename ToDataType::FieldType;
131
250
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
250
                UInt32 from_scale = 0;
133
134
250
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
250
                    const auto* from_decimal_type =
136
250
                            check_and_get_data_type<FromDataType>(from_type.get());
137
250
                    from_precision =
138
250
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
250
                    from_scale = from_decimal_type->get_scale();
140
250
                }
141
142
250
                UInt32 to_max_digits = 0;
143
250
                UInt32 to_precision = 0;
144
250
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
250
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
250
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
250
                    to_precision = to_max_digits;
160
250
                }
161
162
250
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
250
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
250
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
250
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
250
                return narrow_integral || multiply_may_overflow;
171
250
            }
172
0
            return false;
173
250
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
120
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
21
            using Types2 = std::decay_t<decltype(types2)>;
122
21
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
21
                using FromFieldType = typename FromDataType::FieldType;
130
21
                using ToFieldType = typename ToDataType::FieldType;
131
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
21
                UInt32 from_scale = 0;
133
134
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
21
                    const auto* from_decimal_type =
136
21
                            check_and_get_data_type<FromDataType>(from_type.get());
137
21
                    from_precision =
138
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
21
                    from_scale = from_decimal_type->get_scale();
140
21
                }
141
142
21
                UInt32 to_max_digits = 0;
143
21
                UInt32 to_precision = 0;
144
21
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
21
                    to_precision = to_max_digits;
160
21
                }
161
162
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
21
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
21
                return narrow_integral || multiply_may_overflow;
171
21
            }
172
0
            return false;
173
21
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
120
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
16
            using Types2 = std::decay_t<decltype(types2)>;
122
16
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
16
            return false;
173
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
120
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
24
            using Types2 = std::decay_t<decltype(types2)>;
122
24
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
24
            return false;
173
24
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
120
276
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
276
            using Types2 = std::decay_t<decltype(types2)>;
122
276
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
276
            return false;
173
276
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
120
18.1k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
18.1k
            using Types2 = std::decay_t<decltype(types2)>;
122
18.1k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
18.1k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
18.1k
                return false;
127
18.1k
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
18.1k
            return false;
173
18.1k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
120
479
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
479
            using Types2 = std::decay_t<decltype(types2)>;
122
479
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
479
            return false;
173
479
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
1.29k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.29k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.29k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
1.29k
            return false;
173
1.29k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
120
593
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
593
            using Types2 = std::decay_t<decltype(types2)>;
122
593
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
593
            return false;
173
593
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
120
7.70k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7.70k
            using Types2 = std::decay_t<decltype(types2)>;
122
7.70k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
7.70k
            return false;
173
7.70k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
120
315
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
315
            using Types2 = std::decay_t<decltype(types2)>;
122
315
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
315
            return false;
173
315
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
120
642
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
642
            using Types2 = std::decay_t<decltype(types2)>;
122
642
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
642
            return false;
173
642
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
2.33k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2.33k
            using Types2 = std::decay_t<decltype(types2)>;
122
2.33k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
2.33k
            return false;
173
2.33k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
120
313
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
313
            using Types2 = std::decay_t<decltype(types2)>;
122
313
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
313
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
313
                using FromFieldType = typename FromDataType::FieldType;
130
313
                using ToFieldType = typename ToDataType::FieldType;
131
313
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
313
                UInt32 from_scale = 0;
133
134
313
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
313
                    const auto* from_decimal_type =
136
313
                            check_and_get_data_type<FromDataType>(from_type.get());
137
313
                    from_precision =
138
313
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
313
                    from_scale = from_decimal_type->get_scale();
140
313
                }
141
142
313
                UInt32 to_max_digits = 0;
143
313
                UInt32 to_precision = 0;
144
313
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
313
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
313
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
313
                    to_precision = to_max_digits;
160
313
                }
161
162
313
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
313
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
313
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
313
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
313
                return narrow_integral || multiply_may_overflow;
171
313
            }
172
0
            return false;
173
313
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
120
318
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
318
            using Types2 = std::decay_t<decltype(types2)>;
122
318
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
318
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
318
                using FromFieldType = typename FromDataType::FieldType;
130
318
                using ToFieldType = typename ToDataType::FieldType;
131
318
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
318
                UInt32 from_scale = 0;
133
134
318
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
318
                    const auto* from_decimal_type =
136
318
                            check_and_get_data_type<FromDataType>(from_type.get());
137
318
                    from_precision =
138
318
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
318
                    from_scale = from_decimal_type->get_scale();
140
318
                }
141
142
318
                UInt32 to_max_digits = 0;
143
318
                UInt32 to_precision = 0;
144
318
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
318
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
318
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
318
                    to_precision = to_max_digits;
160
318
                }
161
162
318
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
318
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
318
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
318
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
318
                return narrow_integral || multiply_may_overflow;
171
318
            }
172
0
            return false;
173
318
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
120
304
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
304
            using Types2 = std::decay_t<decltype(types2)>;
122
304
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
304
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
304
                using FromFieldType = typename FromDataType::FieldType;
130
304
                using ToFieldType = typename ToDataType::FieldType;
131
304
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
304
                UInt32 from_scale = 0;
133
134
304
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
304
                    const auto* from_decimal_type =
136
304
                            check_and_get_data_type<FromDataType>(from_type.get());
137
304
                    from_precision =
138
304
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
304
                    from_scale = from_decimal_type->get_scale();
140
304
                }
141
142
304
                UInt32 to_max_digits = 0;
143
304
                UInt32 to_precision = 0;
144
304
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
304
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
304
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
304
                    to_precision = to_max_digits;
160
304
                }
161
162
304
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
304
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
304
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
304
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
304
                return narrow_integral || multiply_may_overflow;
171
304
            }
172
0
            return false;
173
304
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
120
747
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
747
            using Types2 = std::decay_t<decltype(types2)>;
122
747
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
747
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
747
                using FromFieldType = typename FromDataType::FieldType;
130
747
                using ToFieldType = typename ToDataType::FieldType;
131
747
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
747
                UInt32 from_scale = 0;
133
134
747
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
747
                    const auto* from_decimal_type =
136
747
                            check_and_get_data_type<FromDataType>(from_type.get());
137
747
                    from_precision =
138
747
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
747
                    from_scale = from_decimal_type->get_scale();
140
747
                }
141
142
747
                UInt32 to_max_digits = 0;
143
747
                UInt32 to_precision = 0;
144
747
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
747
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
747
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
747
                    to_precision = to_max_digits;
160
747
                }
161
162
747
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
747
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
747
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
747
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
747
                return narrow_integral || multiply_may_overflow;
171
747
            }
172
0
            return false;
173
747
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
120
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
21
            using Types2 = std::decay_t<decltype(types2)>;
122
21
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
21
                using FromFieldType = typename FromDataType::FieldType;
130
21
                using ToFieldType = typename ToDataType::FieldType;
131
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
21
                UInt32 from_scale = 0;
133
134
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
21
                    const auto* from_decimal_type =
136
21
                            check_and_get_data_type<FromDataType>(from_type.get());
137
21
                    from_precision =
138
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
21
                    from_scale = from_decimal_type->get_scale();
140
21
                }
141
142
21
                UInt32 to_max_digits = 0;
143
21
                UInt32 to_precision = 0;
144
21
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
21
                    to_precision = to_max_digits;
160
21
                }
161
162
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
21
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
21
                return narrow_integral || multiply_may_overflow;
171
21
            }
172
0
            return false;
173
21
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
120
1.25k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.25k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.25k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
1.25k
            return false;
173
1.25k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
120
1.26k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.26k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.26k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
1.26k
            return false;
173
1.26k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
120
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
4
            using Types2 = std::decay_t<decltype(types2)>;
122
4
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
4
            return false;
173
4
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
120
20.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
20.2k
            using Types2 = std::decay_t<decltype(types2)>;
122
20.2k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
20.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
20.2k
                return false;
127
20.2k
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
20.2k
            return false;
173
20.2k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
120
155
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
155
            using Types2 = std::decay_t<decltype(types2)>;
122
155
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
155
            return false;
173
155
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
109
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
109
            using Types2 = std::decay_t<decltype(types2)>;
122
109
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
109
            return false;
173
109
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
120
79
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
79
            using Types2 = std::decay_t<decltype(types2)>;
122
79
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
79
            return false;
173
79
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
120
135
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
135
            using Types2 = std::decay_t<decltype(types2)>;
122
135
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
135
            return false;
173
135
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
120
587
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
587
            using Types2 = std::decay_t<decltype(types2)>;
122
587
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
587
            return false;
173
587
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
120
9
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
9
            using Types2 = std::decay_t<decltype(types2)>;
122
9
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
9
            return false;
173
9
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
13
            using Types2 = std::decay_t<decltype(types2)>;
122
13
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
13
            return false;
173
13
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
120
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
18
            using Types2 = std::decay_t<decltype(types2)>;
122
18
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
18
                using FromFieldType = typename FromDataType::FieldType;
130
18
                using ToFieldType = typename ToDataType::FieldType;
131
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
18
                UInt32 from_scale = 0;
133
134
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
18
                    const auto* from_decimal_type =
136
18
                            check_and_get_data_type<FromDataType>(from_type.get());
137
18
                    from_precision =
138
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
18
                    from_scale = from_decimal_type->get_scale();
140
18
                }
141
142
18
                UInt32 to_max_digits = 0;
143
18
                UInt32 to_precision = 0;
144
18
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
18
                    to_precision = to_max_digits;
160
18
                }
161
162
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
18
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
18
                return narrow_integral || multiply_may_overflow;
171
18
            }
172
0
            return false;
173
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
120
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
21
            using Types2 = std::decay_t<decltype(types2)>;
122
21
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
21
                using FromFieldType = typename FromDataType::FieldType;
130
21
                using ToFieldType = typename ToDataType::FieldType;
131
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
21
                UInt32 from_scale = 0;
133
134
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
21
                    const auto* from_decimal_type =
136
21
                            check_and_get_data_type<FromDataType>(from_type.get());
137
21
                    from_precision =
138
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
21
                    from_scale = from_decimal_type->get_scale();
140
21
                }
141
142
21
                UInt32 to_max_digits = 0;
143
21
                UInt32 to_precision = 0;
144
21
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
21
                    to_precision = to_max_digits;
160
21
                }
161
162
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
21
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
21
                return narrow_integral || multiply_may_overflow;
171
21
            }
172
0
            return false;
173
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
120
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
8
            using Types2 = std::decay_t<decltype(types2)>;
122
8
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
8
                using FromFieldType = typename FromDataType::FieldType;
130
8
                using ToFieldType = typename ToDataType::FieldType;
131
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
8
                UInt32 from_scale = 0;
133
134
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
8
                    const auto* from_decimal_type =
136
8
                            check_and_get_data_type<FromDataType>(from_type.get());
137
8
                    from_precision =
138
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
8
                    from_scale = from_decimal_type->get_scale();
140
8
                }
141
142
8
                UInt32 to_max_digits = 0;
143
8
                UInt32 to_precision = 0;
144
8
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
8
                    to_precision = to_max_digits;
160
8
                }
161
162
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
8
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
8
                return narrow_integral || multiply_may_overflow;
171
8
            }
172
0
            return false;
173
8
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
120
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
21
            using Types2 = std::decay_t<decltype(types2)>;
122
21
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
21
                using FromFieldType = typename FromDataType::FieldType;
130
21
                using ToFieldType = typename ToDataType::FieldType;
131
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
21
                UInt32 from_scale = 0;
133
134
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
21
                    const auto* from_decimal_type =
136
21
                            check_and_get_data_type<FromDataType>(from_type.get());
137
21
                    from_precision =
138
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
21
                    from_scale = from_decimal_type->get_scale();
140
21
                }
141
142
21
                UInt32 to_max_digits = 0;
143
21
                UInt32 to_precision = 0;
144
21
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
21
                    to_precision = to_max_digits;
160
21
                }
161
162
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
21
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
21
                return narrow_integral || multiply_may_overflow;
171
21
            }
172
0
            return false;
173
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
120
782
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
782
            using Types2 = std::decay_t<decltype(types2)>;
122
782
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
782
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
782
                using FromFieldType = typename FromDataType::FieldType;
130
782
                using ToFieldType = typename ToDataType::FieldType;
131
782
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
782
                UInt32 from_scale = 0;
133
134
782
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
782
                    const auto* from_decimal_type =
136
782
                            check_and_get_data_type<FromDataType>(from_type.get());
137
782
                    from_precision =
138
782
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
782
                    from_scale = from_decimal_type->get_scale();
140
782
                }
141
142
782
                UInt32 to_max_digits = 0;
143
782
                UInt32 to_precision = 0;
144
782
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
782
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
782
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
782
                    to_precision = to_max_digits;
160
782
                }
161
162
782
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
782
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
782
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
782
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
782
                return narrow_integral || multiply_may_overflow;
171
782
            }
172
0
            return false;
173
782
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
120
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2
            using Types2 = std::decay_t<decltype(types2)>;
122
2
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
2
            return false;
173
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
120
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
16
            using Types2 = std::decay_t<decltype(types2)>;
122
16
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
16
            return false;
173
16
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
120
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
4
            using Types2 = std::decay_t<decltype(types2)>;
122
4
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
4
            return false;
173
4
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
120
2.30k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2.30k
            using Types2 = std::decay_t<decltype(types2)>;
122
2.30k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
2.30k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
2.30k
                return false;
127
2.30k
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
2.30k
            return false;
173
2.30k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
120
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2
            using Types2 = std::decay_t<decltype(types2)>;
122
2
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
2
            return false;
173
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
29
            using Types2 = std::decay_t<decltype(types2)>;
122
29
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
29
            return false;
173
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
120
6
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
6
            using Types2 = std::decay_t<decltype(types2)>;
122
6
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
6
            return false;
173
6
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
120
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
18
            using Types2 = std::decay_t<decltype(types2)>;
122
18
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
18
            return false;
173
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
120
6
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
6
            using Types2 = std::decay_t<decltype(types2)>;
122
6
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
6
            return false;
173
6
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
120
120
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
120
            using Types2 = std::decay_t<decltype(types2)>;
122
120
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
120
            return false;
173
120
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
89
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
89
            using Types2 = std::decay_t<decltype(types2)>;
122
89
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
89
            return false;
173
89
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
120
117
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
117
            using Types2 = std::decay_t<decltype(types2)>;
122
117
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
117
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
117
                using FromFieldType = typename FromDataType::FieldType;
130
117
                using ToFieldType = typename ToDataType::FieldType;
131
117
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
117
                UInt32 from_scale = 0;
133
134
117
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
117
                    const auto* from_decimal_type =
136
117
                            check_and_get_data_type<FromDataType>(from_type.get());
137
117
                    from_precision =
138
117
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
117
                    from_scale = from_decimal_type->get_scale();
140
117
                }
141
142
117
                UInt32 to_max_digits = 0;
143
117
                UInt32 to_precision = 0;
144
117
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
117
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
117
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
117
                    to_precision = to_max_digits;
160
117
                }
161
162
117
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
117
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
117
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
117
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
117
                return narrow_integral || multiply_may_overflow;
171
117
            }
172
0
            return false;
173
117
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
120
112
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
112
            using Types2 = std::decay_t<decltype(types2)>;
122
112
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
112
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
112
                using FromFieldType = typename FromDataType::FieldType;
130
112
                using ToFieldType = typename ToDataType::FieldType;
131
112
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
112
                UInt32 from_scale = 0;
133
134
112
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
112
                    const auto* from_decimal_type =
136
112
                            check_and_get_data_type<FromDataType>(from_type.get());
137
112
                    from_precision =
138
112
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
112
                    from_scale = from_decimal_type->get_scale();
140
112
                }
141
142
112
                UInt32 to_max_digits = 0;
143
112
                UInt32 to_precision = 0;
144
112
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
112
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
112
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
112
                    to_precision = to_max_digits;
160
112
                }
161
162
112
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
112
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
112
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
112
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
112
                return narrow_integral || multiply_may_overflow;
171
112
            }
172
0
            return false;
173
112
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
120
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
14
            using Types2 = std::decay_t<decltype(types2)>;
122
14
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
14
                using FromFieldType = typename FromDataType::FieldType;
130
14
                using ToFieldType = typename ToDataType::FieldType;
131
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
14
                UInt32 from_scale = 0;
133
134
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
14
                    const auto* from_decimal_type =
136
14
                            check_and_get_data_type<FromDataType>(from_type.get());
137
14
                    from_precision =
138
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
14
                    from_scale = from_decimal_type->get_scale();
140
14
                }
141
142
14
                UInt32 to_max_digits = 0;
143
14
                UInt32 to_precision = 0;
144
14
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
14
                    to_precision = to_max_digits;
160
14
                }
161
162
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
14
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
14
                return narrow_integral || multiply_may_overflow;
171
14
            }
172
0
            return false;
173
14
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
120
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
99
            using Types2 = std::decay_t<decltype(types2)>;
122
99
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
99
                using FromFieldType = typename FromDataType::FieldType;
130
99
                using ToFieldType = typename ToDataType::FieldType;
131
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
99
                UInt32 from_scale = 0;
133
134
99
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
99
                    const auto* from_decimal_type =
136
99
                            check_and_get_data_type<FromDataType>(from_type.get());
137
99
                    from_precision =
138
99
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
99
                    from_scale = from_decimal_type->get_scale();
140
99
                }
141
142
99
                UInt32 to_max_digits = 0;
143
99
                UInt32 to_precision = 0;
144
99
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
99
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
99
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
99
                    to_precision = to_max_digits;
160
99
                }
161
162
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
99
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
99
                return narrow_integral || multiply_may_overflow;
171
99
            }
172
0
            return false;
173
99
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
120
554
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
554
            using Types2 = std::decay_t<decltype(types2)>;
122
554
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
554
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
554
                using FromFieldType = typename FromDataType::FieldType;
130
554
                using ToFieldType = typename ToDataType::FieldType;
131
554
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
554
                UInt32 from_scale = 0;
133
134
554
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
554
                    const auto* from_decimal_type =
136
554
                            check_and_get_data_type<FromDataType>(from_type.get());
137
554
                    from_precision =
138
554
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
554
                    from_scale = from_decimal_type->get_scale();
140
554
                }
141
142
554
                UInt32 to_max_digits = 0;
143
554
                UInt32 to_precision = 0;
144
554
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
554
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
554
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
554
                    to_precision = to_max_digits;
160
554
                }
161
162
554
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
554
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
554
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
554
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
554
                return narrow_integral || multiply_may_overflow;
171
554
            }
172
0
            return false;
173
554
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
120
39
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
39
            using Types2 = std::decay_t<decltype(types2)>;
122
39
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
39
            return false;
173
39
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
120
7.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7.78k
            using Types2 = std::decay_t<decltype(types2)>;
122
7.78k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
7.78k
            return false;
173
7.78k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
120
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
162
            using Types2 = std::decay_t<decltype(types2)>;
122
162
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
162
            return false;
173
162
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
120
1.63k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.63k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.63k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
1.63k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
1.63k
                return false;
127
1.63k
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
1.63k
            return false;
173
1.63k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
120
415
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
415
            using Types2 = std::decay_t<decltype(types2)>;
122
415
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
415
            return false;
173
415
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
460
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
460
            using Types2 = std::decay_t<decltype(types2)>;
122
460
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
460
            return false;
173
460
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
120
1.01k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.01k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.01k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
1.01k
            return false;
173
1.01k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
120
1.09k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.09k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.09k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
1.09k
            return false;
173
1.09k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
120
1.45k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.45k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.45k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
1.45k
            return false;
173
1.45k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
120
198
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
198
            using Types2 = std::decay_t<decltype(types2)>;
122
198
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
198
            return false;
173
198
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
120
1.14k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.14k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.14k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
1.14k
            return false;
173
1.14k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
120
457
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
457
            using Types2 = std::decay_t<decltype(types2)>;
122
457
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
457
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
457
                using FromFieldType = typename FromDataType::FieldType;
130
457
                using ToFieldType = typename ToDataType::FieldType;
131
457
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
457
                UInt32 from_scale = 0;
133
134
457
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
457
                    const auto* from_decimal_type =
136
457
                            check_and_get_data_type<FromDataType>(from_type.get());
137
457
                    from_precision =
138
457
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
457
                    from_scale = from_decimal_type->get_scale();
140
457
                }
141
142
457
                UInt32 to_max_digits = 0;
143
457
                UInt32 to_precision = 0;
144
457
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
457
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
457
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
457
                    to_precision = to_max_digits;
160
457
                }
161
162
457
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
457
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
457
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
457
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
457
                return narrow_integral || multiply_may_overflow;
171
457
            }
172
0
            return false;
173
457
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
120
333
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
333
            using Types2 = std::decay_t<decltype(types2)>;
122
333
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
333
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
333
                using FromFieldType = typename FromDataType::FieldType;
130
333
                using ToFieldType = typename ToDataType::FieldType;
131
333
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
333
                UInt32 from_scale = 0;
133
134
333
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
333
                    const auto* from_decimal_type =
136
333
                            check_and_get_data_type<FromDataType>(from_type.get());
137
333
                    from_precision =
138
333
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
333
                    from_scale = from_decimal_type->get_scale();
140
333
                }
141
142
333
                UInt32 to_max_digits = 0;
143
333
                UInt32 to_precision = 0;
144
333
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
333
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
333
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
333
                    to_precision = to_max_digits;
160
333
                }
161
162
333
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
333
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
333
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
333
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
333
                return narrow_integral || multiply_may_overflow;
171
333
            }
172
0
            return false;
173
333
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
120
54
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
54
            using Types2 = std::decay_t<decltype(types2)>;
122
54
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
54
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
54
                using FromFieldType = typename FromDataType::FieldType;
130
54
                using ToFieldType = typename ToDataType::FieldType;
131
54
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
54
                UInt32 from_scale = 0;
133
134
54
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
54
                    const auto* from_decimal_type =
136
54
                            check_and_get_data_type<FromDataType>(from_type.get());
137
54
                    from_precision =
138
54
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
54
                    from_scale = from_decimal_type->get_scale();
140
54
                }
141
142
54
                UInt32 to_max_digits = 0;
143
54
                UInt32 to_precision = 0;
144
54
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
54
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
54
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
54
                    to_precision = to_max_digits;
160
54
                }
161
162
54
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
54
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
54
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
54
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
54
                return narrow_integral || multiply_may_overflow;
171
54
            }
172
0
            return false;
173
54
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
120
692
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
692
            using Types2 = std::decay_t<decltype(types2)>;
122
692
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
692
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
692
                using FromFieldType = typename FromDataType::FieldType;
130
692
                using ToFieldType = typename ToDataType::FieldType;
131
692
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
692
                UInt32 from_scale = 0;
133
134
692
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
692
                    const auto* from_decimal_type =
136
692
                            check_and_get_data_type<FromDataType>(from_type.get());
137
692
                    from_precision =
138
692
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
692
                    from_scale = from_decimal_type->get_scale();
140
692
                }
141
142
692
                UInt32 to_max_digits = 0;
143
692
                UInt32 to_precision = 0;
144
692
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
692
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
692
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
692
                    to_precision = to_max_digits;
160
692
                }
161
162
692
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
692
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
692
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
692
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
692
                return narrow_integral || multiply_may_overflow;
171
692
            }
172
0
            return false;
173
692
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
120
542
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
542
            using Types2 = std::decay_t<decltype(types2)>;
122
542
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
542
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
542
                using FromFieldType = typename FromDataType::FieldType;
130
542
                using ToFieldType = typename ToDataType::FieldType;
131
542
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
542
                UInt32 from_scale = 0;
133
134
542
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
542
                    const auto* from_decimal_type =
136
542
                            check_and_get_data_type<FromDataType>(from_type.get());
137
542
                    from_precision =
138
542
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
542
                    from_scale = from_decimal_type->get_scale();
140
542
                }
141
142
542
                UInt32 to_max_digits = 0;
143
542
                UInt32 to_precision = 0;
144
542
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
542
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
542
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
542
                    to_precision = to_max_digits;
160
542
                }
161
162
542
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
542
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
542
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
542
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
542
                return narrow_integral || multiply_may_overflow;
171
542
            }
172
0
            return false;
173
542
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
120
202
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
202
            using Types2 = std::decay_t<decltype(types2)>;
122
202
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
202
            return false;
173
202
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
120
7.96k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7.96k
            using Types2 = std::decay_t<decltype(types2)>;
122
7.96k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
7.96k
            return false;
173
7.96k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
120
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
162
            using Types2 = std::decay_t<decltype(types2)>;
122
162
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
162
            return false;
173
162
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
120
7.21k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7.21k
            using Types2 = std::decay_t<decltype(types2)>;
122
7.21k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
7.21k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
7.21k
                return false;
127
7.21k
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
7.21k
            return false;
173
7.21k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
120
19
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
19
            using Types2 = std::decay_t<decltype(types2)>;
122
19
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
19
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
19
                using FromFieldType = typename FromDataType::FieldType;
130
19
                using ToFieldType = typename ToDataType::FieldType;
131
19
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
19
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
19
                UInt32 to_max_digits = 0;
143
19
                UInt32 to_precision = 0;
144
19
                UInt32 to_scale = 0;
145
146
19
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
19
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
19
                    const auto* to_decimal_type =
150
19
                            check_and_get_data_type<ToDataType>(to_type.get());
151
19
                    to_precision = to_decimal_type->get_precision();
152
19
                    ToDataType::check_type_precision(to_precision);
153
154
19
                    to_scale = to_decimal_type->get_scale();
155
19
                    ToDataType::check_type_scale(to_scale);
156
19
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
19
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
19
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
19
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
19
                if (to_scale > from_scale) {
167
18
                    multiply_may_overflow &=
168
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
18
                }
170
19
                return narrow_integral || multiply_may_overflow;
171
19
            }
172
0
            return false;
173
19
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
509
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
509
            using Types2 = std::decay_t<decltype(types2)>;
122
509
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
509
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
509
                using FromFieldType = typename FromDataType::FieldType;
130
509
                using ToFieldType = typename ToDataType::FieldType;
131
509
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
509
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
509
                UInt32 to_max_digits = 0;
143
509
                UInt32 to_precision = 0;
144
509
                UInt32 to_scale = 0;
145
146
509
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
509
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
509
                    const auto* to_decimal_type =
150
509
                            check_and_get_data_type<ToDataType>(to_type.get());
151
509
                    to_precision = to_decimal_type->get_precision();
152
509
                    ToDataType::check_type_precision(to_precision);
153
154
509
                    to_scale = to_decimal_type->get_scale();
155
509
                    ToDataType::check_type_scale(to_scale);
156
509
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
509
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
509
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
509
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
509
                if (to_scale > from_scale) {
167
304
                    multiply_may_overflow &=
168
304
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
304
                }
170
509
                return narrow_integral || multiply_may_overflow;
171
509
            }
172
0
            return false;
173
509
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
120
517
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
517
            using Types2 = std::decay_t<decltype(types2)>;
122
517
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
517
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
517
                using FromFieldType = typename FromDataType::FieldType;
130
517
                using ToFieldType = typename ToDataType::FieldType;
131
517
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
517
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
517
                UInt32 to_max_digits = 0;
143
517
                UInt32 to_precision = 0;
144
517
                UInt32 to_scale = 0;
145
146
517
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
517
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
517
                    const auto* to_decimal_type =
150
517
                            check_and_get_data_type<ToDataType>(to_type.get());
151
517
                    to_precision = to_decimal_type->get_precision();
152
517
                    ToDataType::check_type_precision(to_precision);
153
154
517
                    to_scale = to_decimal_type->get_scale();
155
517
                    ToDataType::check_type_scale(to_scale);
156
517
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
517
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
517
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
517
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
517
                if (to_scale > from_scale) {
167
262
                    multiply_may_overflow &=
168
262
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
262
                }
170
517
                return narrow_integral || multiply_may_overflow;
171
517
            }
172
0
            return false;
173
517
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
120
553
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
553
            using Types2 = std::decay_t<decltype(types2)>;
122
553
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
553
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
553
                using FromFieldType = typename FromDataType::FieldType;
130
553
                using ToFieldType = typename ToDataType::FieldType;
131
553
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
553
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
553
                UInt32 to_max_digits = 0;
143
553
                UInt32 to_precision = 0;
144
553
                UInt32 to_scale = 0;
145
146
553
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
553
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
553
                    const auto* to_decimal_type =
150
553
                            check_and_get_data_type<ToDataType>(to_type.get());
151
553
                    to_precision = to_decimal_type->get_precision();
152
553
                    ToDataType::check_type_precision(to_precision);
153
154
553
                    to_scale = to_decimal_type->get_scale();
155
553
                    ToDataType::check_type_scale(to_scale);
156
553
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
553
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
553
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
553
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
553
                if (to_scale > from_scale) {
167
280
                    multiply_may_overflow &=
168
280
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
280
                }
170
553
                return narrow_integral || multiply_may_overflow;
171
553
            }
172
0
            return false;
173
553
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
120
612
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
612
            using Types2 = std::decay_t<decltype(types2)>;
122
612
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
612
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
612
                using FromFieldType = typename FromDataType::FieldType;
130
612
                using ToFieldType = typename ToDataType::FieldType;
131
612
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
612
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
612
                UInt32 to_max_digits = 0;
143
612
                UInt32 to_precision = 0;
144
612
                UInt32 to_scale = 0;
145
146
612
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
612
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
612
                    const auto* to_decimal_type =
150
612
                            check_and_get_data_type<ToDataType>(to_type.get());
151
612
                    to_precision = to_decimal_type->get_precision();
152
612
                    ToDataType::check_type_precision(to_precision);
153
154
612
                    to_scale = to_decimal_type->get_scale();
155
612
                    ToDataType::check_type_scale(to_scale);
156
612
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
612
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
612
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
612
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
612
                if (to_scale > from_scale) {
167
266
                    multiply_may_overflow &=
168
266
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
266
                }
170
612
                return narrow_integral || multiply_may_overflow;
171
612
            }
172
0
            return false;
173
612
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
120
549
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
549
            using Types2 = std::decay_t<decltype(types2)>;
122
549
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
549
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
549
                using FromFieldType = typename FromDataType::FieldType;
130
549
                using ToFieldType = typename ToDataType::FieldType;
131
549
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
549
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
549
                UInt32 to_max_digits = 0;
143
549
                UInt32 to_precision = 0;
144
549
                UInt32 to_scale = 0;
145
146
549
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
549
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
549
                    const auto* to_decimal_type =
150
549
                            check_and_get_data_type<ToDataType>(to_type.get());
151
549
                    to_precision = to_decimal_type->get_precision();
152
549
                    ToDataType::check_type_precision(to_precision);
153
154
549
                    to_scale = to_decimal_type->get_scale();
155
549
                    ToDataType::check_type_scale(to_scale);
156
549
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
549
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
549
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
549
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
549
                if (to_scale > from_scale) {
167
278
                    multiply_may_overflow &=
168
278
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
278
                }
170
549
                return narrow_integral || multiply_may_overflow;
171
549
            }
172
0
            return false;
173
549
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
120
104
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
104
            using Types2 = std::decay_t<decltype(types2)>;
122
104
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
104
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
104
                using FromFieldType = typename FromDataType::FieldType;
130
104
                using ToFieldType = typename ToDataType::FieldType;
131
104
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
104
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
104
                UInt32 to_max_digits = 0;
143
104
                UInt32 to_precision = 0;
144
104
                UInt32 to_scale = 0;
145
146
104
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
104
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
104
                    const auto* to_decimal_type =
150
104
                            check_and_get_data_type<ToDataType>(to_type.get());
151
104
                    to_precision = to_decimal_type->get_precision();
152
104
                    ToDataType::check_type_precision(to_precision);
153
154
104
                    to_scale = to_decimal_type->get_scale();
155
104
                    ToDataType::check_type_scale(to_scale);
156
104
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
104
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
104
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
104
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
104
                if (to_scale > from_scale) {
167
68
                    multiply_may_overflow &=
168
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
68
                }
170
104
                return narrow_integral || multiply_may_overflow;
171
104
            }
172
0
            return false;
173
104
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
308
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
308
            using Types2 = std::decay_t<decltype(types2)>;
122
308
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
308
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
308
                using FromFieldType = typename FromDataType::FieldType;
130
308
                using ToFieldType = typename ToDataType::FieldType;
131
308
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
308
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
308
                UInt32 to_max_digits = 0;
143
308
                UInt32 to_precision = 0;
144
308
                UInt32 to_scale = 0;
145
146
308
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
308
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
308
                    const auto* to_decimal_type =
150
308
                            check_and_get_data_type<ToDataType>(to_type.get());
151
308
                    to_precision = to_decimal_type->get_precision();
152
308
                    ToDataType::check_type_precision(to_precision);
153
154
308
                    to_scale = to_decimal_type->get_scale();
155
308
                    ToDataType::check_type_scale(to_scale);
156
308
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
308
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
308
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
308
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
308
                if (to_scale > from_scale) {
167
258
                    multiply_may_overflow &=
168
258
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
258
                }
170
308
                return narrow_integral || multiply_may_overflow;
171
308
            }
172
0
            return false;
173
308
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
120
417
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
417
            using Types2 = std::decay_t<decltype(types2)>;
122
417
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
417
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
417
                using FromFieldType = typename FromDataType::FieldType;
130
417
                using ToFieldType = typename ToDataType::FieldType;
131
417
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
417
                UInt32 from_scale = 0;
133
134
417
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
417
                    const auto* from_decimal_type =
136
417
                            check_and_get_data_type<FromDataType>(from_type.get());
137
417
                    from_precision =
138
417
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
417
                    from_scale = from_decimal_type->get_scale();
140
417
                }
141
142
417
                UInt32 to_max_digits = 0;
143
417
                UInt32 to_precision = 0;
144
417
                UInt32 to_scale = 0;
145
146
417
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
417
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
417
                    const auto* to_decimal_type =
150
417
                            check_and_get_data_type<ToDataType>(to_type.get());
151
417
                    to_precision = to_decimal_type->get_precision();
152
417
                    ToDataType::check_type_precision(to_precision);
153
154
417
                    to_scale = to_decimal_type->get_scale();
155
417
                    ToDataType::check_type_scale(to_scale);
156
417
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
417
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
417
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
417
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
417
                if (to_scale > from_scale) {
167
90
                    multiply_may_overflow &=
168
90
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
90
                }
170
417
                return narrow_integral || multiply_may_overflow;
171
417
            }
172
0
            return false;
173
417
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
120
620
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
620
            using Types2 = std::decay_t<decltype(types2)>;
122
620
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
620
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
620
                using FromFieldType = typename FromDataType::FieldType;
130
620
                using ToFieldType = typename ToDataType::FieldType;
131
620
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
620
                UInt32 from_scale = 0;
133
134
620
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
620
                    const auto* from_decimal_type =
136
620
                            check_and_get_data_type<FromDataType>(from_type.get());
137
620
                    from_precision =
138
620
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
620
                    from_scale = from_decimal_type->get_scale();
140
620
                }
141
142
620
                UInt32 to_max_digits = 0;
143
620
                UInt32 to_precision = 0;
144
620
                UInt32 to_scale = 0;
145
146
620
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
620
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
620
                    const auto* to_decimal_type =
150
620
                            check_and_get_data_type<ToDataType>(to_type.get());
151
620
                    to_precision = to_decimal_type->get_precision();
152
620
                    ToDataType::check_type_precision(to_precision);
153
154
620
                    to_scale = to_decimal_type->get_scale();
155
620
                    ToDataType::check_type_scale(to_scale);
156
620
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
620
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
620
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
620
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
620
                if (to_scale > from_scale) {
167
198
                    multiply_may_overflow &=
168
198
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
198
                }
170
620
                return narrow_integral || multiply_may_overflow;
171
620
            }
172
0
            return false;
173
620
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
120
206
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
206
            using Types2 = std::decay_t<decltype(types2)>;
122
206
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
206
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
206
                using FromFieldType = typename FromDataType::FieldType;
130
206
                using ToFieldType = typename ToDataType::FieldType;
131
206
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
206
                UInt32 from_scale = 0;
133
134
206
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
206
                    const auto* from_decimal_type =
136
206
                            check_and_get_data_type<FromDataType>(from_type.get());
137
206
                    from_precision =
138
206
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
206
                    from_scale = from_decimal_type->get_scale();
140
206
                }
141
142
206
                UInt32 to_max_digits = 0;
143
206
                UInt32 to_precision = 0;
144
206
                UInt32 to_scale = 0;
145
146
206
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
206
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
206
                    const auto* to_decimal_type =
150
206
                            check_and_get_data_type<ToDataType>(to_type.get());
151
206
                    to_precision = to_decimal_type->get_precision();
152
206
                    ToDataType::check_type_precision(to_precision);
153
154
206
                    to_scale = to_decimal_type->get_scale();
155
206
                    ToDataType::check_type_scale(to_scale);
156
206
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
206
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
206
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
206
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
206
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
206
                return narrow_integral || multiply_may_overflow;
171
206
            }
172
0
            return false;
173
206
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
120
436
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
436
            using Types2 = std::decay_t<decltype(types2)>;
122
436
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
436
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
436
                using FromFieldType = typename FromDataType::FieldType;
130
436
                using ToFieldType = typename ToDataType::FieldType;
131
436
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
436
                UInt32 from_scale = 0;
133
134
436
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
436
                    const auto* from_decimal_type =
136
436
                            check_and_get_data_type<FromDataType>(from_type.get());
137
436
                    from_precision =
138
436
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
436
                    from_scale = from_decimal_type->get_scale();
140
436
                }
141
142
436
                UInt32 to_max_digits = 0;
143
436
                UInt32 to_precision = 0;
144
436
                UInt32 to_scale = 0;
145
146
436
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
436
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
436
                    const auto* to_decimal_type =
150
436
                            check_and_get_data_type<ToDataType>(to_type.get());
151
436
                    to_precision = to_decimal_type->get_precision();
152
436
                    ToDataType::check_type_precision(to_precision);
153
154
436
                    to_scale = to_decimal_type->get_scale();
155
436
                    ToDataType::check_type_scale(to_scale);
156
436
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
436
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
436
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
436
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
436
                if (to_scale > from_scale) {
167
142
                    multiply_may_overflow &=
168
142
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
142
                }
170
436
                return narrow_integral || multiply_may_overflow;
171
436
            }
172
0
            return false;
173
436
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Line
Count
Source
120
303
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
303
            using Types2 = std::decay_t<decltype(types2)>;
122
303
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
303
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
303
                using FromFieldType = typename FromDataType::FieldType;
130
303
                using ToFieldType = typename ToDataType::FieldType;
131
303
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
303
                UInt32 from_scale = 0;
133
134
303
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
303
                    const auto* from_decimal_type =
136
303
                            check_and_get_data_type<FromDataType>(from_type.get());
137
303
                    from_precision =
138
303
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
303
                    from_scale = from_decimal_type->get_scale();
140
303
                }
141
142
303
                UInt32 to_max_digits = 0;
143
303
                UInt32 to_precision = 0;
144
303
                UInt32 to_scale = 0;
145
146
303
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
303
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
303
                    const auto* to_decimal_type =
150
303
                            check_and_get_data_type<ToDataType>(to_type.get());
151
303
                    to_precision = to_decimal_type->get_precision();
152
303
                    ToDataType::check_type_precision(to_precision);
153
154
303
                    to_scale = to_decimal_type->get_scale();
155
303
                    ToDataType::check_type_scale(to_scale);
156
303
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
303
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
303
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
303
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
303
                if (to_scale > from_scale) {
167
79
                    multiply_may_overflow &=
168
79
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
79
                }
170
303
                return narrow_integral || multiply_may_overflow;
171
303
            }
172
0
            return false;
173
303
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
120
2.81k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2.81k
            using Types2 = std::decay_t<decltype(types2)>;
122
2.81k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
2.81k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
2.81k
                return false;
127
2.81k
            }
128
2.81k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
2.81k
                using FromFieldType = typename FromDataType::FieldType;
130
2.81k
                using ToFieldType = typename ToDataType::FieldType;
131
2.81k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
2.81k
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
2.81k
                UInt32 to_max_digits = 0;
143
2.81k
                UInt32 to_precision = 0;
144
2.81k
                UInt32 to_scale = 0;
145
146
2.81k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
2.81k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
2.81k
                    const auto* to_decimal_type =
150
2.81k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
2.81k
                    to_precision = to_decimal_type->get_precision();
152
2.81k
                    ToDataType::check_type_precision(to_precision);
153
154
2.81k
                    to_scale = to_decimal_type->get_scale();
155
2.81k
                    ToDataType::check_type_scale(to_scale);
156
2.81k
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
2.81k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
2.81k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
2.81k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
2.81k
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
2.81k
                return narrow_integral || multiply_may_overflow;
171
2.81k
            }
172
0
            return false;
173
2.81k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
120
17
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
17
            using Types2 = std::decay_t<decltype(types2)>;
122
17
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
17
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
17
                using FromFieldType = typename FromDataType::FieldType;
130
17
                using ToFieldType = typename ToDataType::FieldType;
131
17
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
17
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
17
                UInt32 to_max_digits = 0;
143
17
                UInt32 to_precision = 0;
144
17
                UInt32 to_scale = 0;
145
146
17
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
17
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
17
                    const auto* to_decimal_type =
150
17
                            check_and_get_data_type<ToDataType>(to_type.get());
151
17
                    to_precision = to_decimal_type->get_precision();
152
17
                    ToDataType::check_type_precision(to_precision);
153
154
17
                    to_scale = to_decimal_type->get_scale();
155
17
                    ToDataType::check_type_scale(to_scale);
156
17
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
17
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
17
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
17
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
17
                if (to_scale > from_scale) {
167
16
                    multiply_may_overflow &=
168
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
16
                }
170
17
                return narrow_integral || multiply_may_overflow;
171
17
            }
172
0
            return false;
173
17
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
72
            using Types2 = std::decay_t<decltype(types2)>;
122
72
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
72
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
72
                using FromFieldType = typename FromDataType::FieldType;
130
72
                using ToFieldType = typename ToDataType::FieldType;
131
72
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
72
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
72
                UInt32 to_max_digits = 0;
143
72
                UInt32 to_precision = 0;
144
72
                UInt32 to_scale = 0;
145
146
72
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
72
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
72
                    const auto* to_decimal_type =
150
72
                            check_and_get_data_type<ToDataType>(to_type.get());
151
72
                    to_precision = to_decimal_type->get_precision();
152
72
                    ToDataType::check_type_precision(to_precision);
153
154
72
                    to_scale = to_decimal_type->get_scale();
155
72
                    ToDataType::check_type_scale(to_scale);
156
72
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
72
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
72
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
72
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
72
                if (to_scale > from_scale) {
167
59
                    multiply_may_overflow &=
168
59
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
59
                }
170
72
                return narrow_integral || multiply_may_overflow;
171
72
            }
172
0
            return false;
173
72
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
120
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
49
            using Types2 = std::decay_t<decltype(types2)>;
122
49
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
49
                using FromFieldType = typename FromDataType::FieldType;
130
49
                using ToFieldType = typename ToDataType::FieldType;
131
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
49
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
49
                UInt32 to_max_digits = 0;
143
49
                UInt32 to_precision = 0;
144
49
                UInt32 to_scale = 0;
145
146
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
49
                    const auto* to_decimal_type =
150
49
                            check_and_get_data_type<ToDataType>(to_type.get());
151
49
                    to_precision = to_decimal_type->get_precision();
152
49
                    ToDataType::check_type_precision(to_precision);
153
154
49
                    to_scale = to_decimal_type->get_scale();
155
49
                    ToDataType::check_type_scale(to_scale);
156
49
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
49
                if (to_scale > from_scale) {
167
38
                    multiply_may_overflow &=
168
38
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
38
                }
170
49
                return narrow_integral || multiply_may_overflow;
171
49
            }
172
0
            return false;
173
49
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
120
482
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
482
            using Types2 = std::decay_t<decltype(types2)>;
122
482
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
482
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
482
                using FromFieldType = typename FromDataType::FieldType;
130
482
                using ToFieldType = typename ToDataType::FieldType;
131
482
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
482
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
482
                UInt32 to_max_digits = 0;
143
482
                UInt32 to_precision = 0;
144
482
                UInt32 to_scale = 0;
145
146
482
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
482
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
482
                    const auto* to_decimal_type =
150
482
                            check_and_get_data_type<ToDataType>(to_type.get());
151
482
                    to_precision = to_decimal_type->get_precision();
152
482
                    ToDataType::check_type_precision(to_precision);
153
154
482
                    to_scale = to_decimal_type->get_scale();
155
482
                    ToDataType::check_type_scale(to_scale);
156
482
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
482
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
482
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
482
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
482
                if (to_scale > from_scale) {
167
325
                    multiply_may_overflow &=
168
325
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
325
                }
170
482
                return narrow_integral || multiply_may_overflow;
171
482
            }
172
0
            return false;
173
482
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
120
50
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
50
            using Types2 = std::decay_t<decltype(types2)>;
122
50
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
50
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
50
                using FromFieldType = typename FromDataType::FieldType;
130
50
                using ToFieldType = typename ToDataType::FieldType;
131
50
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
50
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
50
                UInt32 to_max_digits = 0;
143
50
                UInt32 to_precision = 0;
144
50
                UInt32 to_scale = 0;
145
146
50
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
50
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
50
                    const auto* to_decimal_type =
150
50
                            check_and_get_data_type<ToDataType>(to_type.get());
151
50
                    to_precision = to_decimal_type->get_precision();
152
50
                    ToDataType::check_type_precision(to_precision);
153
154
50
                    to_scale = to_decimal_type->get_scale();
155
50
                    ToDataType::check_type_scale(to_scale);
156
50
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
50
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
50
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
50
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
50
                if (to_scale > from_scale) {
167
29
                    multiply_may_overflow &=
168
29
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
29
                }
170
50
                return narrow_integral || multiply_may_overflow;
171
50
            }
172
0
            return false;
173
50
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
120
65
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
65
            using Types2 = std::decay_t<decltype(types2)>;
122
65
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
65
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
65
                using FromFieldType = typename FromDataType::FieldType;
130
65
                using ToFieldType = typename ToDataType::FieldType;
131
65
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
65
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
65
                UInt32 to_max_digits = 0;
143
65
                UInt32 to_precision = 0;
144
65
                UInt32 to_scale = 0;
145
146
65
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
65
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
65
                    const auto* to_decimal_type =
150
65
                            check_and_get_data_type<ToDataType>(to_type.get());
151
65
                    to_precision = to_decimal_type->get_precision();
152
65
                    ToDataType::check_type_precision(to_precision);
153
154
65
                    to_scale = to_decimal_type->get_scale();
155
65
                    ToDataType::check_type_scale(to_scale);
156
65
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
65
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
65
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
65
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
65
                if (to_scale > from_scale) {
167
39
                    multiply_may_overflow &=
168
39
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
39
                }
170
65
                return narrow_integral || multiply_may_overflow;
171
65
            }
172
0
            return false;
173
65
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
120
107
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
107
            using Types2 = std::decay_t<decltype(types2)>;
122
107
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
107
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
107
                using FromFieldType = typename FromDataType::FieldType;
130
107
                using ToFieldType = typename ToDataType::FieldType;
131
107
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
107
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
107
                UInt32 to_max_digits = 0;
143
107
                UInt32 to_precision = 0;
144
107
                UInt32 to_scale = 0;
145
146
107
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
107
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
107
                    const auto* to_decimal_type =
150
107
                            check_and_get_data_type<ToDataType>(to_type.get());
151
107
                    to_precision = to_decimal_type->get_precision();
152
107
                    ToDataType::check_type_precision(to_precision);
153
154
107
                    to_scale = to_decimal_type->get_scale();
155
107
                    ToDataType::check_type_scale(to_scale);
156
107
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
107
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
107
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
107
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
107
                if (to_scale > from_scale) {
167
65
                    multiply_may_overflow &=
168
65
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
65
                }
170
107
                return narrow_integral || multiply_may_overflow;
171
107
            }
172
0
            return false;
173
107
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
210
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
210
            using Types2 = std::decay_t<decltype(types2)>;
122
210
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
210
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
210
                using FromFieldType = typename FromDataType::FieldType;
130
210
                using ToFieldType = typename ToDataType::FieldType;
131
210
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
210
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
210
                UInt32 to_max_digits = 0;
143
210
                UInt32 to_precision = 0;
144
210
                UInt32 to_scale = 0;
145
146
210
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
210
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
210
                    const auto* to_decimal_type =
150
210
                            check_and_get_data_type<ToDataType>(to_type.get());
151
210
                    to_precision = to_decimal_type->get_precision();
152
210
                    ToDataType::check_type_precision(to_precision);
153
154
210
                    to_scale = to_decimal_type->get_scale();
155
210
                    ToDataType::check_type_scale(to_scale);
156
210
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
210
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
210
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
210
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
210
                if (to_scale > from_scale) {
167
177
                    multiply_may_overflow &=
168
177
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
177
                }
170
210
                return narrow_integral || multiply_may_overflow;
171
210
            }
172
0
            return false;
173
210
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
120
1.11k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.11k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.11k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
1.11k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.11k
                using FromFieldType = typename FromDataType::FieldType;
130
1.11k
                using ToFieldType = typename ToDataType::FieldType;
131
1.11k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.11k
                UInt32 from_scale = 0;
133
134
1.11k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
1.11k
                    const auto* from_decimal_type =
136
1.11k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
1.11k
                    from_precision =
138
1.11k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
1.11k
                    from_scale = from_decimal_type->get_scale();
140
1.11k
                }
141
142
1.11k
                UInt32 to_max_digits = 0;
143
1.11k
                UInt32 to_precision = 0;
144
1.11k
                UInt32 to_scale = 0;
145
146
1.11k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.11k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.11k
                    const auto* to_decimal_type =
150
1.11k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.11k
                    to_precision = to_decimal_type->get_precision();
152
1.11k
                    ToDataType::check_type_precision(to_precision);
153
154
1.11k
                    to_scale = to_decimal_type->get_scale();
155
1.11k
                    ToDataType::check_type_scale(to_scale);
156
1.11k
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
1.11k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.11k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.11k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.11k
                if (to_scale > from_scale) {
167
770
                    multiply_may_overflow &=
168
770
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
770
                }
170
1.11k
                return narrow_integral || multiply_may_overflow;
171
1.11k
            }
172
0
            return false;
173
1.11k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
120
10.5k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
10.5k
            using Types2 = std::decay_t<decltype(types2)>;
122
10.5k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
10.5k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
10.5k
                using FromFieldType = typename FromDataType::FieldType;
130
10.5k
                using ToFieldType = typename ToDataType::FieldType;
131
10.5k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
10.5k
                UInt32 from_scale = 0;
133
134
10.5k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
10.5k
                    const auto* from_decimal_type =
136
10.5k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
10.5k
                    from_precision =
138
10.5k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
10.5k
                    from_scale = from_decimal_type->get_scale();
140
10.5k
                }
141
142
10.5k
                UInt32 to_max_digits = 0;
143
10.5k
                UInt32 to_precision = 0;
144
10.5k
                UInt32 to_scale = 0;
145
146
10.5k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
10.5k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
10.5k
                    const auto* to_decimal_type =
150
10.5k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
10.5k
                    to_precision = to_decimal_type->get_precision();
152
10.5k
                    ToDataType::check_type_precision(to_precision);
153
154
10.5k
                    to_scale = to_decimal_type->get_scale();
155
10.5k
                    ToDataType::check_type_scale(to_scale);
156
10.5k
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
10.5k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
10.5k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
10.5k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
10.5k
                if (to_scale > from_scale) {
167
157
                    multiply_may_overflow &=
168
157
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
157
                }
170
10.5k
                return narrow_integral || multiply_may_overflow;
171
10.5k
            }
172
0
            return false;
173
10.5k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
120
216
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
216
            using Types2 = std::decay_t<decltype(types2)>;
122
216
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
216
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
216
                using FromFieldType = typename FromDataType::FieldType;
130
216
                using ToFieldType = typename ToDataType::FieldType;
131
216
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
216
                UInt32 from_scale = 0;
133
134
216
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
216
                    const auto* from_decimal_type =
136
216
                            check_and_get_data_type<FromDataType>(from_type.get());
137
216
                    from_precision =
138
216
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
216
                    from_scale = from_decimal_type->get_scale();
140
216
                }
141
142
216
                UInt32 to_max_digits = 0;
143
216
                UInt32 to_precision = 0;
144
216
                UInt32 to_scale = 0;
145
146
216
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
216
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
216
                    const auto* to_decimal_type =
150
216
                            check_and_get_data_type<ToDataType>(to_type.get());
151
216
                    to_precision = to_decimal_type->get_precision();
152
216
                    ToDataType::check_type_precision(to_precision);
153
154
216
                    to_scale = to_decimal_type->get_scale();
155
216
                    ToDataType::check_type_scale(to_scale);
156
216
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
216
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
216
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
216
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
216
                if (to_scale > from_scale) {
167
50
                    multiply_may_overflow &=
168
50
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
50
                }
170
216
                return narrow_integral || multiply_may_overflow;
171
216
            }
172
0
            return false;
173
216
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
120
430
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
430
            using Types2 = std::decay_t<decltype(types2)>;
122
430
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
430
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
430
                using FromFieldType = typename FromDataType::FieldType;
130
430
                using ToFieldType = typename ToDataType::FieldType;
131
430
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
430
                UInt32 from_scale = 0;
133
134
430
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
430
                    const auto* from_decimal_type =
136
430
                            check_and_get_data_type<FromDataType>(from_type.get());
137
430
                    from_precision =
138
430
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
430
                    from_scale = from_decimal_type->get_scale();
140
430
                }
141
142
430
                UInt32 to_max_digits = 0;
143
430
                UInt32 to_precision = 0;
144
430
                UInt32 to_scale = 0;
145
146
430
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
430
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
430
                    const auto* to_decimal_type =
150
430
                            check_and_get_data_type<ToDataType>(to_type.get());
151
430
                    to_precision = to_decimal_type->get_precision();
152
430
                    ToDataType::check_type_precision(to_precision);
153
154
430
                    to_scale = to_decimal_type->get_scale();
155
430
                    ToDataType::check_type_scale(to_scale);
156
430
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
430
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
430
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
430
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
430
                if (to_scale > from_scale) {
167
146
                    multiply_may_overflow &=
168
146
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
146
                }
170
430
                return narrow_integral || multiply_may_overflow;
171
430
            }
172
0
            return false;
173
430
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Line
Count
Source
120
401
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
401
            using Types2 = std::decay_t<decltype(types2)>;
122
401
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
401
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
401
                using FromFieldType = typename FromDataType::FieldType;
130
401
                using ToFieldType = typename ToDataType::FieldType;
131
401
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
401
                UInt32 from_scale = 0;
133
134
401
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
401
                    const auto* from_decimal_type =
136
401
                            check_and_get_data_type<FromDataType>(from_type.get());
137
401
                    from_precision =
138
401
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
401
                    from_scale = from_decimal_type->get_scale();
140
401
                }
141
142
401
                UInt32 to_max_digits = 0;
143
401
                UInt32 to_precision = 0;
144
401
                UInt32 to_scale = 0;
145
146
401
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
401
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
401
                    const auto* to_decimal_type =
150
401
                            check_and_get_data_type<ToDataType>(to_type.get());
151
401
                    to_precision = to_decimal_type->get_precision();
152
401
                    ToDataType::check_type_precision(to_precision);
153
154
401
                    to_scale = to_decimal_type->get_scale();
155
401
                    ToDataType::check_type_scale(to_scale);
156
401
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
401
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
401
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
401
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
401
                if (to_scale > from_scale) {
167
137
                    multiply_may_overflow &=
168
137
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
137
                }
170
401
                return narrow_integral || multiply_may_overflow;
171
401
            }
172
0
            return false;
173
401
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
120
7.88k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7.88k
            using Types2 = std::decay_t<decltype(types2)>;
122
7.88k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
7.88k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
7.88k
                return false;
127
7.88k
            }
128
7.88k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
7.88k
                using FromFieldType = typename FromDataType::FieldType;
130
7.88k
                using ToFieldType = typename ToDataType::FieldType;
131
7.88k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
7.88k
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
7.88k
                UInt32 to_max_digits = 0;
143
7.88k
                UInt32 to_precision = 0;
144
7.88k
                UInt32 to_scale = 0;
145
146
7.88k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
7.88k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
7.88k
                    const auto* to_decimal_type =
150
7.88k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
7.88k
                    to_precision = to_decimal_type->get_precision();
152
7.88k
                    ToDataType::check_type_precision(to_precision);
153
154
7.88k
                    to_scale = to_decimal_type->get_scale();
155
7.88k
                    ToDataType::check_type_scale(to_scale);
156
7.88k
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
7.88k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
7.88k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
7.88k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
7.88k
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
7.88k
                return narrow_integral || multiply_may_overflow;
171
7.88k
            }
172
0
            return false;
173
7.88k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
120
19
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
19
            using Types2 = std::decay_t<decltype(types2)>;
122
19
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
19
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
19
                using FromFieldType = typename FromDataType::FieldType;
130
19
                using ToFieldType = typename ToDataType::FieldType;
131
19
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
19
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
19
                UInt32 to_max_digits = 0;
143
19
                UInt32 to_precision = 0;
144
19
                UInt32 to_scale = 0;
145
146
19
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
19
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
19
                    const auto* to_decimal_type =
150
19
                            check_and_get_data_type<ToDataType>(to_type.get());
151
19
                    to_precision = to_decimal_type->get_precision();
152
19
                    ToDataType::check_type_precision(to_precision);
153
154
19
                    to_scale = to_decimal_type->get_scale();
155
19
                    ToDataType::check_type_scale(to_scale);
156
19
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
19
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
19
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
19
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
20
                if (to_scale > from_scale) {
167
20
                    multiply_may_overflow &=
168
20
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
20
                }
170
20
                return narrow_integral || multiply_may_overflow;
171
19
            }
172
0
            return false;
173
19
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
16
            using Types2 = std::decay_t<decltype(types2)>;
122
16
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
16
                using FromFieldType = typename FromDataType::FieldType;
130
16
                using ToFieldType = typename ToDataType::FieldType;
131
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
16
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
16
                UInt32 to_max_digits = 0;
143
16
                UInt32 to_precision = 0;
144
16
                UInt32 to_scale = 0;
145
146
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
16
                    const auto* to_decimal_type =
150
16
                            check_and_get_data_type<ToDataType>(to_type.get());
151
16
                    to_precision = to_decimal_type->get_precision();
152
16
                    ToDataType::check_type_precision(to_precision);
153
154
16
                    to_scale = to_decimal_type->get_scale();
155
16
                    ToDataType::check_type_scale(to_scale);
156
16
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
16
                if (to_scale > from_scale) {
167
16
                    multiply_may_overflow &=
168
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
16
                }
170
16
                return narrow_integral || multiply_may_overflow;
171
16
            }
172
0
            return false;
173
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
120
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
16
            using Types2 = std::decay_t<decltype(types2)>;
122
16
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
16
                using FromFieldType = typename FromDataType::FieldType;
130
16
                using ToFieldType = typename ToDataType::FieldType;
131
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
16
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
16
                UInt32 to_max_digits = 0;
143
16
                UInt32 to_precision = 0;
144
16
                UInt32 to_scale = 0;
145
146
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
16
                    const auto* to_decimal_type =
150
16
                            check_and_get_data_type<ToDataType>(to_type.get());
151
16
                    to_precision = to_decimal_type->get_precision();
152
16
                    ToDataType::check_type_precision(to_precision);
153
154
16
                    to_scale = to_decimal_type->get_scale();
155
16
                    ToDataType::check_type_scale(to_scale);
156
16
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
16
                if (to_scale > from_scale) {
167
16
                    multiply_may_overflow &=
168
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
16
                }
170
16
                return narrow_integral || multiply_may_overflow;
171
16
            }
172
0
            return false;
173
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
120
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
16
            using Types2 = std::decay_t<decltype(types2)>;
122
16
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
16
                using FromFieldType = typename FromDataType::FieldType;
130
16
                using ToFieldType = typename ToDataType::FieldType;
131
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
16
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
16
                UInt32 to_max_digits = 0;
143
16
                UInt32 to_precision = 0;
144
16
                UInt32 to_scale = 0;
145
146
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
16
                    const auto* to_decimal_type =
150
16
                            check_and_get_data_type<ToDataType>(to_type.get());
151
16
                    to_precision = to_decimal_type->get_precision();
152
16
                    ToDataType::check_type_precision(to_precision);
153
154
16
                    to_scale = to_decimal_type->get_scale();
155
16
                    ToDataType::check_type_scale(to_scale);
156
16
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
16
                if (to_scale > from_scale) {
167
16
                    multiply_may_overflow &=
168
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
16
                }
170
16
                return narrow_integral || multiply_may_overflow;
171
16
            }
172
0
            return false;
173
16
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
120
32
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
32
            using Types2 = std::decay_t<decltype(types2)>;
122
32
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
32
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
32
                using FromFieldType = typename FromDataType::FieldType;
130
32
                using ToFieldType = typename ToDataType::FieldType;
131
32
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
32
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
32
                UInt32 to_max_digits = 0;
143
32
                UInt32 to_precision = 0;
144
32
                UInt32 to_scale = 0;
145
146
32
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
32
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
32
                    const auto* to_decimal_type =
150
32
                            check_and_get_data_type<ToDataType>(to_type.get());
151
32
                    to_precision = to_decimal_type->get_precision();
152
32
                    ToDataType::check_type_precision(to_precision);
153
154
32
                    to_scale = to_decimal_type->get_scale();
155
32
                    ToDataType::check_type_scale(to_scale);
156
32
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
32
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
32
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
32
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
32
                if (to_scale > from_scale) {
167
32
                    multiply_may_overflow &=
168
32
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
32
                }
170
32
                return narrow_integral || multiply_may_overflow;
171
32
            }
172
0
            return false;
173
32
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
127
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
127
            using Types2 = std::decay_t<decltype(types2)>;
122
127
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
127
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
127
                using FromFieldType = typename FromDataType::FieldType;
130
127
                using ToFieldType = typename ToDataType::FieldType;
131
127
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
127
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
127
                UInt32 to_max_digits = 0;
143
127
                UInt32 to_precision = 0;
144
127
                UInt32 to_scale = 0;
145
146
127
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
127
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
127
                    const auto* to_decimal_type =
150
127
                            check_and_get_data_type<ToDataType>(to_type.get());
151
127
                    to_precision = to_decimal_type->get_precision();
152
127
                    ToDataType::check_type_precision(to_precision);
153
154
127
                    to_scale = to_decimal_type->get_scale();
155
127
                    ToDataType::check_type_scale(to_scale);
156
127
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
127
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
128
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
127
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
128
                if (to_scale > from_scale) {
167
128
                    multiply_may_overflow &=
168
128
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
128
                }
170
127
                return narrow_integral || multiply_may_overflow;
171
127
            }
172
0
            return false;
173
127
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
120
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1
            using Types2 = std::decay_t<decltype(types2)>;
122
1
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
1
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
1
                return false;
127
1
            }
128
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1
                using FromFieldType = typename FromDataType::FieldType;
130
1
                using ToFieldType = typename ToDataType::FieldType;
131
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
1
                UInt32 to_max_digits = 0;
143
1
                UInt32 to_precision = 0;
144
1
                UInt32 to_scale = 0;
145
146
1
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1
                    const auto* to_decimal_type =
150
1
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1
                    to_precision = to_decimal_type->get_precision();
152
1
                    ToDataType::check_type_precision(to_precision);
153
154
1
                    to_scale = to_decimal_type->get_scale();
155
1
                    ToDataType::check_type_scale(to_scale);
156
1
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
1
                return narrow_integral || multiply_may_overflow;
171
1
            }
172
0
            return false;
173
1
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
120
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
23
            using Types2 = std::decay_t<decltype(types2)>;
122
23
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
23
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
23
                using FromFieldType = typename FromDataType::FieldType;
130
23
                using ToFieldType = typename ToDataType::FieldType;
131
23
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
23
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
23
                UInt32 to_max_digits = 0;
143
23
                UInt32 to_precision = 0;
144
23
                UInt32 to_scale = 0;
145
146
23
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
23
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
23
                    const auto* to_decimal_type =
150
23
                            check_and_get_data_type<ToDataType>(to_type.get());
151
23
                    to_precision = to_decimal_type->get_precision();
152
23
                    ToDataType::check_type_precision(to_precision);
153
154
23
                    to_scale = to_decimal_type->get_scale();
155
23
                    ToDataType::check_type_scale(to_scale);
156
23
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
23
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
23
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
23
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
23
                if (to_scale > from_scale) {
167
22
                    multiply_may_overflow &=
168
22
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
22
                }
170
23
                return narrow_integral || multiply_may_overflow;
171
23
            }
172
0
            return false;
173
23
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
179
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
179
            using Types2 = std::decay_t<decltype(types2)>;
122
179
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
179
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
179
                using FromFieldType = typename FromDataType::FieldType;
130
179
                using ToFieldType = typename ToDataType::FieldType;
131
179
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
179
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
179
                UInt32 to_max_digits = 0;
143
179
                UInt32 to_precision = 0;
144
179
                UInt32 to_scale = 0;
145
146
179
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
179
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
179
                    const auto* to_decimal_type =
150
179
                            check_and_get_data_type<ToDataType>(to_type.get());
151
179
                    to_precision = to_decimal_type->get_precision();
152
179
                    ToDataType::check_type_precision(to_precision);
153
154
179
                    to_scale = to_decimal_type->get_scale();
155
179
                    ToDataType::check_type_scale(to_scale);
156
179
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
179
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
179
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
179
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
179
                if (to_scale > from_scale) {
167
128
                    multiply_may_overflow &=
168
128
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
128
                }
170
179
                return narrow_integral || multiply_may_overflow;
171
179
            }
172
0
            return false;
173
179
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
120
166
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
166
            using Types2 = std::decay_t<decltype(types2)>;
122
166
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
166
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
166
                using FromFieldType = typename FromDataType::FieldType;
130
166
                using ToFieldType = typename ToDataType::FieldType;
131
166
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
166
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
166
                UInt32 to_max_digits = 0;
143
166
                UInt32 to_precision = 0;
144
166
                UInt32 to_scale = 0;
145
146
166
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
166
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
166
                    const auto* to_decimal_type =
150
166
                            check_and_get_data_type<ToDataType>(to_type.get());
151
166
                    to_precision = to_decimal_type->get_precision();
152
166
                    ToDataType::check_type_precision(to_precision);
153
154
166
                    to_scale = to_decimal_type->get_scale();
155
166
                    ToDataType::check_type_scale(to_scale);
156
166
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
166
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
166
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
166
                if (to_scale > from_scale) {
167
115
                    multiply_may_overflow &=
168
115
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
115
                }
170
166
                return narrow_integral || multiply_may_overflow;
171
166
            }
172
0
            return false;
173
166
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
120
456
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
456
            using Types2 = std::decay_t<decltype(types2)>;
122
456
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
456
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
456
                using FromFieldType = typename FromDataType::FieldType;
130
456
                using ToFieldType = typename ToDataType::FieldType;
131
456
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
456
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
456
                UInt32 to_max_digits = 0;
143
456
                UInt32 to_precision = 0;
144
456
                UInt32 to_scale = 0;
145
146
456
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
456
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
456
                    const auto* to_decimal_type =
150
456
                            check_and_get_data_type<ToDataType>(to_type.get());
151
456
                    to_precision = to_decimal_type->get_precision();
152
456
                    ToDataType::check_type_precision(to_precision);
153
154
456
                    to_scale = to_decimal_type->get_scale();
155
456
                    ToDataType::check_type_scale(to_scale);
156
456
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
456
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
456
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
456
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
456
                if (to_scale > from_scale) {
167
401
                    multiply_may_overflow &=
168
401
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
401
                }
170
456
                return narrow_integral || multiply_may_overflow;
171
456
            }
172
0
            return false;
173
456
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
120
2.61k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2.61k
            using Types2 = std::decay_t<decltype(types2)>;
122
2.61k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
2.61k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
2.61k
                using FromFieldType = typename FromDataType::FieldType;
130
2.61k
                using ToFieldType = typename ToDataType::FieldType;
131
2.61k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
2.61k
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
2.61k
                UInt32 to_max_digits = 0;
143
2.61k
                UInt32 to_precision = 0;
144
2.61k
                UInt32 to_scale = 0;
145
146
2.61k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
2.61k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
2.61k
                    const auto* to_decimal_type =
150
2.61k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
2.61k
                    to_precision = to_decimal_type->get_precision();
152
2.61k
                    ToDataType::check_type_precision(to_precision);
153
154
2.61k
                    to_scale = to_decimal_type->get_scale();
155
2.61k
                    ToDataType::check_type_scale(to_scale);
156
2.61k
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
2.61k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
2.61k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
2.61k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
2.61k
                if (to_scale > from_scale) {
167
656
                    multiply_may_overflow &=
168
656
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
656
                }
170
2.61k
                return narrow_integral || multiply_may_overflow;
171
2.61k
            }
172
0
            return false;
173
2.61k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
120
367
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
367
            using Types2 = std::decay_t<decltype(types2)>;
122
367
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
367
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
367
                using FromFieldType = typename FromDataType::FieldType;
130
367
                using ToFieldType = typename ToDataType::FieldType;
131
367
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
367
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
367
                UInt32 to_max_digits = 0;
143
367
                UInt32 to_precision = 0;
144
367
                UInt32 to_scale = 0;
145
146
367
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
367
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
367
                    const auto* to_decimal_type =
150
367
                            check_and_get_data_type<ToDataType>(to_type.get());
151
367
                    to_precision = to_decimal_type->get_precision();
152
367
                    ToDataType::check_type_precision(to_precision);
153
154
367
                    to_scale = to_decimal_type->get_scale();
155
367
                    ToDataType::check_type_scale(to_scale);
156
367
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
367
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
367
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
367
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
367
                if (to_scale > from_scale) {
167
196
                    multiply_may_overflow &=
168
196
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
196
                }
170
367
                return narrow_integral || multiply_may_overflow;
171
367
            }
172
0
            return false;
173
367
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
120
248
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
248
            using Types2 = std::decay_t<decltype(types2)>;
122
248
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
248
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
248
                using FromFieldType = typename FromDataType::FieldType;
130
248
                using ToFieldType = typename ToDataType::FieldType;
131
248
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
248
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
248
                UInt32 to_max_digits = 0;
143
248
                UInt32 to_precision = 0;
144
248
                UInt32 to_scale = 0;
145
146
248
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
248
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
248
                    const auto* to_decimal_type =
150
248
                            check_and_get_data_type<ToDataType>(to_type.get());
151
248
                    to_precision = to_decimal_type->get_precision();
152
248
                    ToDataType::check_type_precision(to_precision);
153
154
248
                    to_scale = to_decimal_type->get_scale();
155
248
                    ToDataType::check_type_scale(to_scale);
156
248
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
248
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
248
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
248
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
248
                if (to_scale > from_scale) {
167
130
                    multiply_may_overflow &=
168
130
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
130
                }
170
248
                return narrow_integral || multiply_may_overflow;
171
248
            }
172
0
            return false;
173
248
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
490
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
490
            using Types2 = std::decay_t<decltype(types2)>;
122
490
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
490
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
490
                using FromFieldType = typename FromDataType::FieldType;
130
490
                using ToFieldType = typename ToDataType::FieldType;
131
490
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
490
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
490
                UInt32 to_max_digits = 0;
143
490
                UInt32 to_precision = 0;
144
490
                UInt32 to_scale = 0;
145
146
490
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
490
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
490
                    const auto* to_decimal_type =
150
490
                            check_and_get_data_type<ToDataType>(to_type.get());
151
490
                    to_precision = to_decimal_type->get_precision();
152
490
                    ToDataType::check_type_precision(to_precision);
153
154
490
                    to_scale = to_decimal_type->get_scale();
155
490
                    ToDataType::check_type_scale(to_scale);
156
490
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
490
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
490
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
490
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
490
                if (to_scale > from_scale) {
167
380
                    multiply_may_overflow &=
168
380
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
380
                }
170
490
                return narrow_integral || multiply_may_overflow;
171
490
            }
172
0
            return false;
173
490
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
120
759
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
759
            using Types2 = std::decay_t<decltype(types2)>;
122
759
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
759
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
759
                using FromFieldType = typename FromDataType::FieldType;
130
759
                using ToFieldType = typename ToDataType::FieldType;
131
759
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
759
                UInt32 from_scale = 0;
133
134
759
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
759
                    const auto* from_decimal_type =
136
759
                            check_and_get_data_type<FromDataType>(from_type.get());
137
759
                    from_precision =
138
759
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
759
                    from_scale = from_decimal_type->get_scale();
140
759
                }
141
142
759
                UInt32 to_max_digits = 0;
143
759
                UInt32 to_precision = 0;
144
759
                UInt32 to_scale = 0;
145
146
759
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
759
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
759
                    const auto* to_decimal_type =
150
759
                            check_and_get_data_type<ToDataType>(to_type.get());
151
759
                    to_precision = to_decimal_type->get_precision();
152
759
                    ToDataType::check_type_precision(to_precision);
153
154
759
                    to_scale = to_decimal_type->get_scale();
155
759
                    ToDataType::check_type_scale(to_scale);
156
759
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
759
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
759
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
759
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
759
                if (to_scale > from_scale) {
167
607
                    multiply_may_overflow &=
168
607
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
607
                }
170
759
                return narrow_integral || multiply_may_overflow;
171
759
            }
172
0
            return false;
173
759
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
120
1.05k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.05k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.05k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
1.05k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.05k
                using FromFieldType = typename FromDataType::FieldType;
130
1.05k
                using ToFieldType = typename ToDataType::FieldType;
131
1.05k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.05k
                UInt32 from_scale = 0;
133
134
1.05k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
1.05k
                    const auto* from_decimal_type =
136
1.05k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
1.05k
                    from_precision =
138
1.05k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
1.05k
                    from_scale = from_decimal_type->get_scale();
140
1.05k
                }
141
142
1.05k
                UInt32 to_max_digits = 0;
143
1.05k
                UInt32 to_precision = 0;
144
1.05k
                UInt32 to_scale = 0;
145
146
1.05k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.05k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.05k
                    const auto* to_decimal_type =
150
1.05k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.05k
                    to_precision = to_decimal_type->get_precision();
152
1.05k
                    ToDataType::check_type_precision(to_precision);
153
154
1.05k
                    to_scale = to_decimal_type->get_scale();
155
1.05k
                    ToDataType::check_type_scale(to_scale);
156
1.05k
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
1.05k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.05k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.05k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.05k
                if (to_scale > from_scale) {
167
717
                    multiply_may_overflow &=
168
717
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
717
                }
170
1.05k
                return narrow_integral || multiply_may_overflow;
171
1.05k
            }
172
0
            return false;
173
1.05k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
120
257
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
257
            using Types2 = std::decay_t<decltype(types2)>;
122
257
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
257
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
257
                using FromFieldType = typename FromDataType::FieldType;
130
257
                using ToFieldType = typename ToDataType::FieldType;
131
257
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
257
                UInt32 from_scale = 0;
133
134
257
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
257
                    const auto* from_decimal_type =
136
257
                            check_and_get_data_type<FromDataType>(from_type.get());
137
257
                    from_precision =
138
257
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
257
                    from_scale = from_decimal_type->get_scale();
140
257
                }
141
142
257
                UInt32 to_max_digits = 0;
143
257
                UInt32 to_precision = 0;
144
257
                UInt32 to_scale = 0;
145
146
257
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
257
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
257
                    const auto* to_decimal_type =
150
257
                            check_and_get_data_type<ToDataType>(to_type.get());
151
257
                    to_precision = to_decimal_type->get_precision();
152
257
                    ToDataType::check_type_precision(to_precision);
153
154
257
                    to_scale = to_decimal_type->get_scale();
155
257
                    ToDataType::check_type_scale(to_scale);
156
257
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
257
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
257
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
257
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
257
                if (to_scale > from_scale) {
167
71
                    multiply_may_overflow &=
168
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
71
                }
170
257
                return narrow_integral || multiply_may_overflow;
171
257
            }
172
0
            return false;
173
257
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
120
3.03k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
3.03k
            using Types2 = std::decay_t<decltype(types2)>;
122
3.03k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
3.03k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
3.03k
                using FromFieldType = typename FromDataType::FieldType;
130
3.03k
                using ToFieldType = typename ToDataType::FieldType;
131
3.03k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
3.03k
                UInt32 from_scale = 0;
133
134
3.03k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
3.03k
                    const auto* from_decimal_type =
136
3.03k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
3.03k
                    from_precision =
138
3.03k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
3.03k
                    from_scale = from_decimal_type->get_scale();
140
3.03k
                }
141
142
3.03k
                UInt32 to_max_digits = 0;
143
3.03k
                UInt32 to_precision = 0;
144
3.03k
                UInt32 to_scale = 0;
145
146
3.03k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
3.03k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
3.03k
                    const auto* to_decimal_type =
150
3.03k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
3.03k
                    to_precision = to_decimal_type->get_precision();
152
3.03k
                    ToDataType::check_type_precision(to_precision);
153
154
3.03k
                    to_scale = to_decimal_type->get_scale();
155
3.03k
                    ToDataType::check_type_scale(to_scale);
156
3.03k
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
3.03k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
3.03k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
3.03k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
3.03k
                if (to_scale > from_scale) {
167
746
                    multiply_may_overflow &=
168
746
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
746
                }
170
3.03k
                return narrow_integral || multiply_may_overflow;
171
3.03k
            }
172
0
            return false;
173
3.03k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Line
Count
Source
120
948
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
948
            using Types2 = std::decay_t<decltype(types2)>;
122
948
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
948
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
948
                using FromFieldType = typename FromDataType::FieldType;
130
948
                using ToFieldType = typename ToDataType::FieldType;
131
948
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
948
                UInt32 from_scale = 0;
133
134
948
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
948
                    const auto* from_decimal_type =
136
948
                            check_and_get_data_type<FromDataType>(from_type.get());
137
948
                    from_precision =
138
948
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
948
                    from_scale = from_decimal_type->get_scale();
140
948
                }
141
142
948
                UInt32 to_max_digits = 0;
143
948
                UInt32 to_precision = 0;
144
948
                UInt32 to_scale = 0;
145
146
948
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
948
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
948
                    const auto* to_decimal_type =
150
948
                            check_and_get_data_type<ToDataType>(to_type.get());
151
948
                    to_precision = to_decimal_type->get_precision();
152
948
                    ToDataType::check_type_precision(to_precision);
153
154
948
                    to_scale = to_decimal_type->get_scale();
155
948
                    ToDataType::check_type_scale(to_scale);
156
948
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
948
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
948
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
948
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
948
                if (to_scale > from_scale) {
167
394
                    multiply_may_overflow &=
168
394
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
394
                }
170
948
                return narrow_integral || multiply_may_overflow;
171
948
            }
172
0
            return false;
173
948
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
120
5.28k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
5.28k
            using Types2 = std::decay_t<decltype(types2)>;
122
5.28k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
5.28k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
5.28k
                return false;
127
5.28k
            }
128
5.28k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
5.28k
                using FromFieldType = typename FromDataType::FieldType;
130
5.28k
                using ToFieldType = typename ToDataType::FieldType;
131
5.28k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
5.28k
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
5.28k
                UInt32 to_max_digits = 0;
143
5.28k
                UInt32 to_precision = 0;
144
5.28k
                UInt32 to_scale = 0;
145
146
5.28k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
5.28k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
5.28k
                    const auto* to_decimal_type =
150
5.28k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
5.28k
                    to_precision = to_decimal_type->get_precision();
152
5.28k
                    ToDataType::check_type_precision(to_precision);
153
154
5.28k
                    to_scale = to_decimal_type->get_scale();
155
5.28k
                    ToDataType::check_type_scale(to_scale);
156
5.28k
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
5.28k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
5.28k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
5.28k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
5.28k
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
5.28k
                return narrow_integral || multiply_may_overflow;
171
5.28k
            }
172
0
            return false;
173
5.28k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
120
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7
            using Types2 = std::decay_t<decltype(types2)>;
122
7
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
7
                using FromFieldType = typename FromDataType::FieldType;
130
7
                using ToFieldType = typename ToDataType::FieldType;
131
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
7
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
7
                UInt32 to_max_digits = 0;
143
7
                UInt32 to_precision = 0;
144
7
                UInt32 to_scale = 0;
145
146
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
7
                    const auto* to_decimal_type =
150
7
                            check_and_get_data_type<ToDataType>(to_type.get());
151
7
                    to_precision = to_decimal_type->get_precision();
152
7
                    ToDataType::check_type_precision(to_precision);
153
154
7
                    to_scale = to_decimal_type->get_scale();
155
7
                    ToDataType::check_type_scale(to_scale);
156
7
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
7
                if (to_scale > from_scale) {
167
6
                    multiply_may_overflow &=
168
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
6
                }
170
7
                return narrow_integral || multiply_may_overflow;
171
7
            }
172
0
            return false;
173
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
160
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
160
            using Types2 = std::decay_t<decltype(types2)>;
122
160
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
160
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
160
                using FromFieldType = typename FromDataType::FieldType;
130
160
                using ToFieldType = typename ToDataType::FieldType;
131
160
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
160
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
160
                UInt32 to_max_digits = 0;
143
160
                UInt32 to_precision = 0;
144
160
                UInt32 to_scale = 0;
145
146
160
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
160
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
160
                    const auto* to_decimal_type =
150
160
                            check_and_get_data_type<ToDataType>(to_type.get());
151
160
                    to_precision = to_decimal_type->get_precision();
152
160
                    ToDataType::check_type_precision(to_precision);
153
154
160
                    to_scale = to_decimal_type->get_scale();
155
160
                    ToDataType::check_type_scale(to_scale);
156
160
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
160
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
160
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
160
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
160
                if (to_scale > from_scale) {
167
109
                    multiply_may_overflow &=
168
109
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
109
                }
170
160
                return narrow_integral || multiply_may_overflow;
171
160
            }
172
0
            return false;
173
160
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
120
158
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
158
            using Types2 = std::decay_t<decltype(types2)>;
122
158
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
158
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
158
                using FromFieldType = typename FromDataType::FieldType;
130
158
                using ToFieldType = typename ToDataType::FieldType;
131
158
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
158
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
158
                UInt32 to_max_digits = 0;
143
158
                UInt32 to_precision = 0;
144
158
                UInt32 to_scale = 0;
145
146
158
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
158
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
158
                    const auto* to_decimal_type =
150
158
                            check_and_get_data_type<ToDataType>(to_type.get());
151
158
                    to_precision = to_decimal_type->get_precision();
152
158
                    ToDataType::check_type_precision(to_precision);
153
154
158
                    to_scale = to_decimal_type->get_scale();
155
158
                    ToDataType::check_type_scale(to_scale);
156
158
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
158
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
158
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
158
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
158
                if (to_scale > from_scale) {
167
107
                    multiply_may_overflow &=
168
107
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
107
                }
170
158
                return narrow_integral || multiply_may_overflow;
171
158
            }
172
0
            return false;
173
158
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
120
176
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
176
            using Types2 = std::decay_t<decltype(types2)>;
122
176
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
176
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
176
                using FromFieldType = typename FromDataType::FieldType;
130
176
                using ToFieldType = typename ToDataType::FieldType;
131
176
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
176
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
176
                UInt32 to_max_digits = 0;
143
176
                UInt32 to_precision = 0;
144
176
                UInt32 to_scale = 0;
145
146
176
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
176
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
176
                    const auto* to_decimal_type =
150
176
                            check_and_get_data_type<ToDataType>(to_type.get());
151
176
                    to_precision = to_decimal_type->get_precision();
152
176
                    ToDataType::check_type_precision(to_precision);
153
154
176
                    to_scale = to_decimal_type->get_scale();
155
176
                    ToDataType::check_type_scale(to_scale);
156
176
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
176
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
176
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
176
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
176
                if (to_scale > from_scale) {
167
120
                    multiply_may_overflow &=
168
120
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
120
                }
170
176
                return narrow_integral || multiply_may_overflow;
171
176
            }
172
0
            return false;
173
176
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
120
158
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
158
            using Types2 = std::decay_t<decltype(types2)>;
122
158
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
158
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
158
                using FromFieldType = typename FromDataType::FieldType;
130
158
                using ToFieldType = typename ToDataType::FieldType;
131
158
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
158
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
158
                UInt32 to_max_digits = 0;
143
158
                UInt32 to_precision = 0;
144
158
                UInt32 to_scale = 0;
145
146
158
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
158
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
158
                    const auto* to_decimal_type =
150
158
                            check_and_get_data_type<ToDataType>(to_type.get());
151
158
                    to_precision = to_decimal_type->get_precision();
152
158
                    ToDataType::check_type_precision(to_precision);
153
154
158
                    to_scale = to_decimal_type->get_scale();
155
158
                    ToDataType::check_type_scale(to_scale);
156
158
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
158
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
158
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
158
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
158
                if (to_scale > from_scale) {
167
107
                    multiply_may_overflow &=
168
107
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
107
                }
170
158
                return narrow_integral || multiply_may_overflow;
171
158
            }
172
0
            return false;
173
158
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
120
232
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
232
            using Types2 = std::decay_t<decltype(types2)>;
122
232
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
232
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
232
                using FromFieldType = typename FromDataType::FieldType;
130
232
                using ToFieldType = typename ToDataType::FieldType;
131
232
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
232
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
232
                UInt32 to_max_digits = 0;
143
232
                UInt32 to_precision = 0;
144
232
                UInt32 to_scale = 0;
145
146
232
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
232
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
232
                    const auto* to_decimal_type =
150
232
                            check_and_get_data_type<ToDataType>(to_type.get());
151
232
                    to_precision = to_decimal_type->get_precision();
152
232
                    ToDataType::check_type_precision(to_precision);
153
154
232
                    to_scale = to_decimal_type->get_scale();
155
232
                    ToDataType::check_type_scale(to_scale);
156
232
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
232
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
232
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
232
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
232
                if (to_scale > from_scale) {
167
170
                    multiply_may_overflow &=
168
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
170
                }
170
232
                return narrow_integral || multiply_may_overflow;
171
232
            }
172
0
            return false;
173
232
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
120
224
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
224
            using Types2 = std::decay_t<decltype(types2)>;
122
224
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
224
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
224
                using FromFieldType = typename FromDataType::FieldType;
130
224
                using ToFieldType = typename ToDataType::FieldType;
131
224
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
224
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
224
                UInt32 to_max_digits = 0;
143
224
                UInt32 to_precision = 0;
144
224
                UInt32 to_scale = 0;
145
146
224
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
224
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
224
                    const auto* to_decimal_type =
150
224
                            check_and_get_data_type<ToDataType>(to_type.get());
151
224
                    to_precision = to_decimal_type->get_precision();
152
224
                    ToDataType::check_type_precision(to_precision);
153
154
224
                    to_scale = to_decimal_type->get_scale();
155
224
                    ToDataType::check_type_scale(to_scale);
156
224
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
224
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
224
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
224
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
224
                if (to_scale > from_scale) {
167
126
                    multiply_may_overflow &=
168
126
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
126
                }
170
224
                return narrow_integral || multiply_may_overflow;
171
224
            }
172
0
            return false;
173
224
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
318
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
318
            using Types2 = std::decay_t<decltype(types2)>;
122
318
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
318
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
318
                using FromFieldType = typename FromDataType::FieldType;
130
318
                using ToFieldType = typename ToDataType::FieldType;
131
318
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
318
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
318
                UInt32 to_max_digits = 0;
143
318
                UInt32 to_precision = 0;
144
318
                UInt32 to_scale = 0;
145
146
318
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
318
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
318
                    const auto* to_decimal_type =
150
318
                            check_and_get_data_type<ToDataType>(to_type.get());
151
318
                    to_precision = to_decimal_type->get_precision();
152
318
                    ToDataType::check_type_precision(to_precision);
153
154
318
                    to_scale = to_decimal_type->get_scale();
155
318
                    ToDataType::check_type_scale(to_scale);
156
318
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
318
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
318
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
318
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
318
                if (to_scale > from_scale) {
167
208
                    multiply_may_overflow &=
168
208
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
208
                }
170
318
                return narrow_integral || multiply_may_overflow;
171
318
            }
172
0
            return false;
173
318
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
120
567
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
567
            using Types2 = std::decay_t<decltype(types2)>;
122
567
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
567
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
567
                using FromFieldType = typename FromDataType::FieldType;
130
567
                using ToFieldType = typename ToDataType::FieldType;
131
567
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
567
                UInt32 from_scale = 0;
133
134
567
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
567
                    const auto* from_decimal_type =
136
567
                            check_and_get_data_type<FromDataType>(from_type.get());
137
567
                    from_precision =
138
567
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
567
                    from_scale = from_decimal_type->get_scale();
140
567
                }
141
142
567
                UInt32 to_max_digits = 0;
143
567
                UInt32 to_precision = 0;
144
567
                UInt32 to_scale = 0;
145
146
567
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
567
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
567
                    const auto* to_decimal_type =
150
567
                            check_and_get_data_type<ToDataType>(to_type.get());
151
567
                    to_precision = to_decimal_type->get_precision();
152
567
                    ToDataType::check_type_precision(to_precision);
153
154
567
                    to_scale = to_decimal_type->get_scale();
155
567
                    ToDataType::check_type_scale(to_scale);
156
567
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
567
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
567
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
567
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
567
                if (to_scale > from_scale) {
167
499
                    multiply_may_overflow &=
168
499
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
499
                }
170
567
                return narrow_integral || multiply_may_overflow;
171
567
            }
172
0
            return false;
173
567
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
120
919
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
919
            using Types2 = std::decay_t<decltype(types2)>;
122
919
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
919
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
919
                using FromFieldType = typename FromDataType::FieldType;
130
919
                using ToFieldType = typename ToDataType::FieldType;
131
919
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
919
                UInt32 from_scale = 0;
133
134
919
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
919
                    const auto* from_decimal_type =
136
919
                            check_and_get_data_type<FromDataType>(from_type.get());
137
919
                    from_precision =
138
919
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
919
                    from_scale = from_decimal_type->get_scale();
140
919
                }
141
142
919
                UInt32 to_max_digits = 0;
143
919
                UInt32 to_precision = 0;
144
919
                UInt32 to_scale = 0;
145
146
919
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
919
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
919
                    const auto* to_decimal_type =
150
919
                            check_and_get_data_type<ToDataType>(to_type.get());
151
919
                    to_precision = to_decimal_type->get_precision();
152
919
                    ToDataType::check_type_precision(to_precision);
153
154
919
                    to_scale = to_decimal_type->get_scale();
155
919
                    ToDataType::check_type_scale(to_scale);
156
919
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
919
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
919
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
919
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
919
                if (to_scale > from_scale) {
167
792
                    multiply_may_overflow &=
168
792
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
792
                }
170
919
                return narrow_integral || multiply_may_overflow;
171
919
            }
172
0
            return false;
173
919
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
120
148
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
148
            using Types2 = std::decay_t<decltype(types2)>;
122
148
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
148
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
148
                using FromFieldType = typename FromDataType::FieldType;
130
148
                using ToFieldType = typename ToDataType::FieldType;
131
148
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
148
                UInt32 from_scale = 0;
133
134
148
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
148
                    const auto* from_decimal_type =
136
148
                            check_and_get_data_type<FromDataType>(from_type.get());
137
148
                    from_precision =
138
148
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
148
                    from_scale = from_decimal_type->get_scale();
140
148
                }
141
142
148
                UInt32 to_max_digits = 0;
143
148
                UInt32 to_precision = 0;
144
148
                UInt32 to_scale = 0;
145
146
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
148
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
148
                    const auto* to_decimal_type =
150
148
                            check_and_get_data_type<ToDataType>(to_type.get());
151
148
                    to_precision = to_decimal_type->get_precision();
152
148
                    ToDataType::check_type_precision(to_precision);
153
154
148
                    to_scale = to_decimal_type->get_scale();
155
148
                    ToDataType::check_type_scale(to_scale);
156
148
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
148
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
148
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
148
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
148
                if (to_scale > from_scale) {
167
84
                    multiply_may_overflow &=
168
84
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
84
                }
170
148
                return narrow_integral || multiply_may_overflow;
171
148
            }
172
0
            return false;
173
148
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
120
1.20k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.20k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.20k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
1.20k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.20k
                using FromFieldType = typename FromDataType::FieldType;
130
1.20k
                using ToFieldType = typename ToDataType::FieldType;
131
1.20k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.20k
                UInt32 from_scale = 0;
133
134
1.20k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
1.20k
                    const auto* from_decimal_type =
136
1.20k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
1.20k
                    from_precision =
138
1.20k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
1.20k
                    from_scale = from_decimal_type->get_scale();
140
1.20k
                }
141
142
1.20k
                UInt32 to_max_digits = 0;
143
1.20k
                UInt32 to_precision = 0;
144
1.20k
                UInt32 to_scale = 0;
145
146
1.20k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.20k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.20k
                    const auto* to_decimal_type =
150
1.20k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.20k
                    to_precision = to_decimal_type->get_precision();
152
1.20k
                    ToDataType::check_type_precision(to_precision);
153
154
1.20k
                    to_scale = to_decimal_type->get_scale();
155
1.20k
                    ToDataType::check_type_scale(to_scale);
156
1.20k
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
1.20k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.20k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.20k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.20k
                if (to_scale > from_scale) {
167
738
                    multiply_may_overflow &=
168
738
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
738
                }
170
1.20k
                return narrow_integral || multiply_may_overflow;
171
1.20k
            }
172
0
            return false;
173
1.20k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
120
928
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
928
            using Types2 = std::decay_t<decltype(types2)>;
122
928
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
928
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
928
                using FromFieldType = typename FromDataType::FieldType;
130
928
                using ToFieldType = typename ToDataType::FieldType;
131
928
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
928
                UInt32 from_scale = 0;
133
134
928
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
928
                    const auto* from_decimal_type =
136
928
                            check_and_get_data_type<FromDataType>(from_type.get());
137
928
                    from_precision =
138
928
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
928
                    from_scale = from_decimal_type->get_scale();
140
928
                }
141
142
928
                UInt32 to_max_digits = 0;
143
928
                UInt32 to_precision = 0;
144
928
                UInt32 to_scale = 0;
145
146
928
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
928
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
928
                    const auto* to_decimal_type =
150
928
                            check_and_get_data_type<ToDataType>(to_type.get());
151
928
                    to_precision = to_decimal_type->get_precision();
152
928
                    ToDataType::check_type_precision(to_precision);
153
154
928
                    to_scale = to_decimal_type->get_scale();
155
928
                    ToDataType::check_type_scale(to_scale);
156
928
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
928
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
928
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
928
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
928
                if (to_scale > from_scale) {
167
453
                    multiply_may_overflow &=
168
453
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
453
                }
170
928
                return narrow_integral || multiply_may_overflow;
171
928
            }
172
0
            return false;
173
928
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
120
5.66k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
5.66k
            using Types2 = std::decay_t<decltype(types2)>;
122
5.66k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
5.66k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
5.66k
                return false;
127
5.66k
            }
128
5.66k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
5.66k
                using FromFieldType = typename FromDataType::FieldType;
130
5.66k
                using ToFieldType = typename ToDataType::FieldType;
131
5.66k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
5.66k
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
5.66k
                UInt32 to_max_digits = 0;
143
5.66k
                UInt32 to_precision = 0;
144
5.66k
                UInt32 to_scale = 0;
145
146
5.66k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
5.66k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
5.66k
                    const auto* to_decimal_type =
150
5.66k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
5.66k
                    to_precision = to_decimal_type->get_precision();
152
5.66k
                    ToDataType::check_type_precision(to_precision);
153
154
5.66k
                    to_scale = to_decimal_type->get_scale();
155
5.66k
                    ToDataType::check_type_scale(to_scale);
156
5.66k
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
5.66k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
5.66k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
5.66k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
5.66k
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
5.66k
                return narrow_integral || multiply_may_overflow;
171
5.66k
            }
172
0
            return false;
173
5.66k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Line
Count
Source
120
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1
            using Types2 = std::decay_t<decltype(types2)>;
122
1
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
1
            return false;
173
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
120
3
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
3
            using Types2 = std::decay_t<decltype(types2)>;
122
3
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
3
            return false;
173
3
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
120
26
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
26
            using Types2 = std::decay_t<decltype(types2)>;
122
26
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
26
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
26
                return false;
127
26
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
26
            return false;
173
26
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Line
Count
Source
120
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
10
            using Types2 = std::decay_t<decltype(types2)>;
122
10
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
10
            return false;
173
10
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
120
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7
            using Types2 = std::decay_t<decltype(types2)>;
122
7
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
7
            return false;
173
7
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
120
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7
            using Types2 = std::decay_t<decltype(types2)>;
122
7
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
7
            return false;
173
7
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Line
Count
Source
120
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2
            using Types2 = std::decay_t<decltype(types2)>;
122
2
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
2
                using FromFieldType = typename FromDataType::FieldType;
130
2
                using ToFieldType = typename ToDataType::FieldType;
131
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
2
                UInt32 from_scale = 0;
133
134
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
2
                    const auto* from_decimal_type =
136
2
                            check_and_get_data_type<FromDataType>(from_type.get());
137
2
                    from_precision =
138
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
2
                    from_scale = from_decimal_type->get_scale();
140
2
                }
141
142
2
                UInt32 to_max_digits = 0;
143
2
                UInt32 to_precision = 0;
144
2
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
2
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
2
                return narrow_integral || multiply_may_overflow;
171
2
            }
172
0
            return false;
173
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Line
Count
Source
120
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
29
            using Types2 = std::decay_t<decltype(types2)>;
122
29
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
29
            return false;
173
29
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Line
Count
Source
120
238
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
238
            using Types2 = std::decay_t<decltype(types2)>;
122
238
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
238
            return false;
173
238
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
120
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1
            using Types2 = std::decay_t<decltype(types2)>;
122
1
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
1
            return false;
173
1
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Line
Count
Source
120
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2
            using Types2 = std::decay_t<decltype(types2)>;
122
2
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
2
            return false;
173
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
120
5.86k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
5.86k
            using Types2 = std::decay_t<decltype(types2)>;
122
5.86k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
5.86k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
5.86k
                return false;
127
5.86k
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
5.86k
            return false;
173
5.86k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Line
Count
Source
120
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
13
            using Types2 = std::decay_t<decltype(types2)>;
122
13
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
13
            return false;
173
13
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
120
33
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
33
            using Types2 = std::decay_t<decltype(types2)>;
122
33
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
33
            return false;
173
33
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
120
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
12
            using Types2 = std::decay_t<decltype(types2)>;
122
12
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
12
            return false;
173
12
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Line
Count
Source
120
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
18
            using Types2 = std::decay_t<decltype(types2)>;
122
18
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
18
                using FromFieldType = typename FromDataType::FieldType;
130
18
                using ToFieldType = typename ToDataType::FieldType;
131
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
18
                UInt32 from_scale = 0;
133
134
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
18
                    const auto* from_decimal_type =
136
18
                            check_and_get_data_type<FromDataType>(from_type.get());
137
18
                    from_precision =
138
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
18
                    from_scale = from_decimal_type->get_scale();
140
18
                }
141
142
18
                UInt32 to_max_digits = 0;
143
18
                UInt32 to_precision = 0;
144
18
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
18
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
18
                return narrow_integral || multiply_may_overflow;
171
18
            }
172
0
            return false;
173
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Line
Count
Source
120
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
14
            using Types2 = std::decay_t<decltype(types2)>;
122
14
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
14
                using FromFieldType = typename FromDataType::FieldType;
130
14
                using ToFieldType = typename ToDataType::FieldType;
131
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
14
                UInt32 from_scale = 0;
133
134
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
14
                    const auto* from_decimal_type =
136
14
                            check_and_get_data_type<FromDataType>(from_type.get());
137
14
                    from_precision =
138
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
14
                    from_scale = from_decimal_type->get_scale();
140
14
                }
141
142
14
                UInt32 to_max_digits = 0;
143
14
                UInt32 to_precision = 0;
144
14
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
14
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
14
                return narrow_integral || multiply_may_overflow;
171
14
            }
172
0
            return false;
173
14
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Line
Count
Source
120
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
5
            using Types2 = std::decay_t<decltype(types2)>;
122
5
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
5
                using FromFieldType = typename FromDataType::FieldType;
130
5
                using ToFieldType = typename ToDataType::FieldType;
131
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
5
                UInt32 from_scale = 0;
133
134
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
5
                    const auto* from_decimal_type =
136
5
                            check_and_get_data_type<FromDataType>(from_type.get());
137
5
                    from_precision =
138
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
5
                    from_scale = from_decimal_type->get_scale();
140
5
                }
141
142
5
                UInt32 to_max_digits = 0;
143
5
                UInt32 to_precision = 0;
144
5
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
5
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
5
                return narrow_integral || multiply_may_overflow;
171
5
            }
172
0
            return false;
173
5
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Line
Count
Source
120
412
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
412
            using Types2 = std::decay_t<decltype(types2)>;
122
412
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
412
            return false;
173
412
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Line
Count
Source
120
113
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
113
            using Types2 = std::decay_t<decltype(types2)>;
122
113
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
113
            return false;
173
113
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
120
36
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
36
            using Types2 = std::decay_t<decltype(types2)>;
122
36
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
36
            return false;
173
36
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Line
Count
Source
120
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
4
            using Types2 = std::decay_t<decltype(types2)>;
122
4
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
4
            return false;
173
4
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Line
Count
Source
120
46
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
46
            using Types2 = std::decay_t<decltype(types2)>;
122
46
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
46
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
46
                return false;
127
46
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
46
            return false;
173
46
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
120
3.86k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
3.86k
            using Types2 = std::decay_t<decltype(types2)>;
122
3.86k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
3.86k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
3.86k
                return false;
127
3.86k
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
3.86k
            return false;
173
3.86k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
120
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
25
            using Types2 = std::decay_t<decltype(types2)>;
122
25
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
25
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
25
                return false;
127
25
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
25
            return false;
173
25
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Line
Count
Source
120
28
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
28
            using Types2 = std::decay_t<decltype(types2)>;
122
28
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
28
            return false;
173
28
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Line
Count
Source
120
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
21
            using Types2 = std::decay_t<decltype(types2)>;
122
21
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
21
            return false;
173
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Line
Count
Source
120
33
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
33
            using Types2 = std::decay_t<decltype(types2)>;
122
33
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
33
            return false;
173
33
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
120
9
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
9
            using Types2 = std::decay_t<decltype(types2)>;
122
9
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
9
            return false;
173
9
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Line
Count
Source
120
3
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
3
            using Types2 = std::decay_t<decltype(types2)>;
122
3
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
3
            return false;
173
3
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Line
Count
Source
120
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7
            using Types2 = std::decay_t<decltype(types2)>;
122
7
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
7
            return false;
173
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
120
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
18
            using Types2 = std::decay_t<decltype(types2)>;
122
18
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
18
            return false;
173
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Line
Count
Source
120
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2
            using Types2 = std::decay_t<decltype(types2)>;
122
2
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
2
                using FromFieldType = typename FromDataType::FieldType;
130
2
                using ToFieldType = typename ToDataType::FieldType;
131
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
2
                UInt32 from_scale = 0;
133
134
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
2
                    const auto* from_decimal_type =
136
2
                            check_and_get_data_type<FromDataType>(from_type.get());
137
2
                    from_precision =
138
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
2
                    from_scale = from_decimal_type->get_scale();
140
2
                }
141
142
2
                UInt32 to_max_digits = 0;
143
2
                UInt32 to_precision = 0;
144
2
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
2
                    to_precision = to_max_digits;
160
2
                }
161
162
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
2
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
2
                return narrow_integral || multiply_may_overflow;
171
2
            }
172
0
            return false;
173
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Line
Count
Source
120
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1
            using Types2 = std::decay_t<decltype(types2)>;
122
1
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1
                using FromFieldType = typename FromDataType::FieldType;
130
1
                using ToFieldType = typename ToDataType::FieldType;
131
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1
                UInt32 from_scale = 0;
133
134
1
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
1
                    const auto* from_decimal_type =
136
1
                            check_and_get_data_type<FromDataType>(from_type.get());
137
1
                    from_precision =
138
1
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
1
                    from_scale = from_decimal_type->get_scale();
140
1
                }
141
142
1
                UInt32 to_max_digits = 0;
143
1
                UInt32 to_precision = 0;
144
1
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
1
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
1
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
1
                    to_precision = to_max_digits;
160
1
                }
161
162
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
1
                return narrow_integral || multiply_may_overflow;
171
1
            }
172
0
            return false;
173
1
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Line
Count
Source
120
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1
            using Types2 = std::decay_t<decltype(types2)>;
122
1
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1
                using FromFieldType = typename FromDataType::FieldType;
130
1
                using ToFieldType = typename ToDataType::FieldType;
131
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1
                UInt32 from_scale = 0;
133
134
1
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
1
                    const auto* from_decimal_type =
136
1
                            check_and_get_data_type<FromDataType>(from_type.get());
137
1
                    from_precision =
138
1
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
1
                    from_scale = from_decimal_type->get_scale();
140
1
                }
141
142
1
                UInt32 to_max_digits = 0;
143
1
                UInt32 to_precision = 0;
144
1
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
1
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
1
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
1
                    to_precision = to_max_digits;
160
1
                }
161
162
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
1
                return narrow_integral || multiply_may_overflow;
171
1
            }
172
0
            return false;
173
1
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Line
Count
Source
120
11
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
11
            using Types2 = std::decay_t<decltype(types2)>;
122
11
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
11
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
11
                using FromFieldType = typename FromDataType::FieldType;
130
11
                using ToFieldType = typename ToDataType::FieldType;
131
11
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
11
                UInt32 from_scale = 0;
133
134
11
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
11
                    const auto* from_decimal_type =
136
11
                            check_and_get_data_type<FromDataType>(from_type.get());
137
11
                    from_precision =
138
11
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
11
                    from_scale = from_decimal_type->get_scale();
140
11
                }
141
142
11
                UInt32 to_max_digits = 0;
143
11
                UInt32 to_precision = 0;
144
11
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
11
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
11
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
11
                    to_precision = to_max_digits;
160
11
                }
161
162
11
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
11
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
11
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
11
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
11
                return narrow_integral || multiply_may_overflow;
171
11
            }
172
0
            return false;
173
11
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Line
Count
Source
120
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
8
            using Types2 = std::decay_t<decltype(types2)>;
122
8
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
8
            return false;
173
8
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Line
Count
Source
120
19
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
19
            using Types2 = std::decay_t<decltype(types2)>;
122
19
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
19
            return false;
173
19
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
120
299
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
299
            using Types2 = std::decay_t<decltype(types2)>;
122
299
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
299
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
299
                return false;
127
299
            }
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
                using FromFieldType = typename FromDataType::FieldType;
130
                using ToFieldType = typename ToDataType::FieldType;
131
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
                UInt32 to_max_digits = 0;
143
                UInt32 to_precision = 0;
144
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
                if (to_scale > from_scale) {
167
                    multiply_may_overflow &=
168
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
                }
170
                return narrow_integral || multiply_may_overflow;
171
            }
172
299
            return false;
173
299
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
174
236k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
110
2.43k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
2.43k
        using Types = std::decay_t<decltype(types)>;
112
2.43k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
2.43k
        return call_on_index_and_data_type<
120
2.43k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2.43k
            using Types2 = std::decay_t<decltype(types2)>;
122
2.43k
            using FromDataType = typename Types2::LeftType;
123
2.43k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
2.43k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
2.43k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
2.43k
                return false;
127
2.43k
            }
128
2.43k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
2.43k
                using FromFieldType = typename FromDataType::FieldType;
130
2.43k
                using ToFieldType = typename ToDataType::FieldType;
131
2.43k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
2.43k
                UInt32 from_scale = 0;
133
134
2.43k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
2.43k
                    const auto* from_decimal_type =
136
2.43k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
2.43k
                    from_precision =
138
2.43k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
2.43k
                    from_scale = from_decimal_type->get_scale();
140
2.43k
                }
141
142
2.43k
                UInt32 to_max_digits = 0;
143
2.43k
                UInt32 to_precision = 0;
144
2.43k
                UInt32 to_scale = 0;
145
146
2.43k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
2.43k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
2.43k
                    const auto* to_decimal_type =
150
2.43k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
2.43k
                    to_precision = to_decimal_type->get_precision();
152
2.43k
                    ToDataType::check_type_precision(to_precision);
153
154
2.43k
                    to_scale = to_decimal_type->get_scale();
155
2.43k
                    ToDataType::check_type_scale(to_scale);
156
2.43k
                }
157
2.43k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
2.43k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
2.43k
                    to_precision = to_max_digits;
160
2.43k
                }
161
162
2.43k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
2.43k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
2.43k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
2.43k
                if (to_scale > from_scale) {
167
2.43k
                    multiply_may_overflow &=
168
2.43k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
2.43k
                }
170
2.43k
                return narrow_integral || multiply_may_overflow;
171
2.43k
            }
172
2.43k
            return false;
173
2.43k
        });
174
2.43k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
110
4.98k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
4.98k
        using Types = std::decay_t<decltype(types)>;
112
4.98k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
4.98k
        return call_on_index_and_data_type<
120
4.98k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
4.98k
            using Types2 = std::decay_t<decltype(types2)>;
122
4.98k
            using FromDataType = typename Types2::LeftType;
123
4.98k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
4.98k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
4.98k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
4.98k
                return false;
127
4.98k
            }
128
4.98k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
4.98k
                using FromFieldType = typename FromDataType::FieldType;
130
4.98k
                using ToFieldType = typename ToDataType::FieldType;
131
4.98k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
4.98k
                UInt32 from_scale = 0;
133
134
4.98k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
4.98k
                    const auto* from_decimal_type =
136
4.98k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
4.98k
                    from_precision =
138
4.98k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
4.98k
                    from_scale = from_decimal_type->get_scale();
140
4.98k
                }
141
142
4.98k
                UInt32 to_max_digits = 0;
143
4.98k
                UInt32 to_precision = 0;
144
4.98k
                UInt32 to_scale = 0;
145
146
4.98k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
4.98k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
4.98k
                    const auto* to_decimal_type =
150
4.98k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
4.98k
                    to_precision = to_decimal_type->get_precision();
152
4.98k
                    ToDataType::check_type_precision(to_precision);
153
154
4.98k
                    to_scale = to_decimal_type->get_scale();
155
4.98k
                    ToDataType::check_type_scale(to_scale);
156
4.98k
                }
157
4.98k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
4.98k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
4.98k
                    to_precision = to_max_digits;
160
4.98k
                }
161
162
4.98k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
4.98k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
4.98k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
4.98k
                if (to_scale > from_scale) {
167
4.98k
                    multiply_may_overflow &=
168
4.98k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
4.98k
                }
170
4.98k
                return narrow_integral || multiply_may_overflow;
171
4.98k
            }
172
4.98k
            return false;
173
4.98k
        });
174
4.98k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
110
5.66k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
5.66k
        using Types = std::decay_t<decltype(types)>;
112
5.66k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
5.66k
        return call_on_index_and_data_type<
120
5.66k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
5.66k
            using Types2 = std::decay_t<decltype(types2)>;
122
5.66k
            using FromDataType = typename Types2::LeftType;
123
5.66k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
5.66k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
5.66k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
5.66k
                return false;
127
5.66k
            }
128
5.66k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
5.66k
                using FromFieldType = typename FromDataType::FieldType;
130
5.66k
                using ToFieldType = typename ToDataType::FieldType;
131
5.66k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
5.66k
                UInt32 from_scale = 0;
133
134
5.66k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
5.66k
                    const auto* from_decimal_type =
136
5.66k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
5.66k
                    from_precision =
138
5.66k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
5.66k
                    from_scale = from_decimal_type->get_scale();
140
5.66k
                }
141
142
5.66k
                UInt32 to_max_digits = 0;
143
5.66k
                UInt32 to_precision = 0;
144
5.66k
                UInt32 to_scale = 0;
145
146
5.66k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
5.66k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
5.66k
                    const auto* to_decimal_type =
150
5.66k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
5.66k
                    to_precision = to_decimal_type->get_precision();
152
5.66k
                    ToDataType::check_type_precision(to_precision);
153
154
5.66k
                    to_scale = to_decimal_type->get_scale();
155
5.66k
                    ToDataType::check_type_scale(to_scale);
156
5.66k
                }
157
5.66k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
5.66k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
5.66k
                    to_precision = to_max_digits;
160
5.66k
                }
161
162
5.66k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
5.66k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
5.66k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
5.66k
                if (to_scale > from_scale) {
167
5.66k
                    multiply_may_overflow &=
168
5.66k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
5.66k
                }
170
5.66k
                return narrow_integral || multiply_may_overflow;
171
5.66k
            }
172
5.66k
            return false;
173
5.66k
        });
174
5.66k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
110
32.2k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
32.2k
        using Types = std::decay_t<decltype(types)>;
112
32.2k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
32.2k
        return call_on_index_and_data_type<
120
32.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
32.2k
            using Types2 = std::decay_t<decltype(types2)>;
122
32.2k
            using FromDataType = typename Types2::LeftType;
123
32.2k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
32.2k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
32.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
32.2k
                return false;
127
32.2k
            }
128
32.2k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
32.2k
                using FromFieldType = typename FromDataType::FieldType;
130
32.2k
                using ToFieldType = typename ToDataType::FieldType;
131
32.2k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
32.2k
                UInt32 from_scale = 0;
133
134
32.2k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
32.2k
                    const auto* from_decimal_type =
136
32.2k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
32.2k
                    from_precision =
138
32.2k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
32.2k
                    from_scale = from_decimal_type->get_scale();
140
32.2k
                }
141
142
32.2k
                UInt32 to_max_digits = 0;
143
32.2k
                UInt32 to_precision = 0;
144
32.2k
                UInt32 to_scale = 0;
145
146
32.2k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
32.2k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
32.2k
                    const auto* to_decimal_type =
150
32.2k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
32.2k
                    to_precision = to_decimal_type->get_precision();
152
32.2k
                    ToDataType::check_type_precision(to_precision);
153
154
32.2k
                    to_scale = to_decimal_type->get_scale();
155
32.2k
                    ToDataType::check_type_scale(to_scale);
156
32.2k
                }
157
32.2k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
32.2k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
32.2k
                    to_precision = to_max_digits;
160
32.2k
                }
161
162
32.2k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
32.2k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
32.2k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
32.2k
                if (to_scale > from_scale) {
167
32.2k
                    multiply_may_overflow &=
168
32.2k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
32.2k
                }
170
32.2k
                return narrow_integral || multiply_may_overflow;
171
32.2k
            }
172
32.2k
            return false;
173
32.2k
        });
174
32.2k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
110
39.6k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
39.6k
        using Types = std::decay_t<decltype(types)>;
112
39.6k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
39.6k
        return call_on_index_and_data_type<
120
39.6k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
39.6k
            using Types2 = std::decay_t<decltype(types2)>;
122
39.6k
            using FromDataType = typename Types2::LeftType;
123
39.6k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
39.6k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
39.6k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
39.6k
                return false;
127
39.6k
            }
128
39.6k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
39.6k
                using FromFieldType = typename FromDataType::FieldType;
130
39.6k
                using ToFieldType = typename ToDataType::FieldType;
131
39.6k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
39.6k
                UInt32 from_scale = 0;
133
134
39.6k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
39.6k
                    const auto* from_decimal_type =
136
39.6k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
39.6k
                    from_precision =
138
39.6k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
39.6k
                    from_scale = from_decimal_type->get_scale();
140
39.6k
                }
141
142
39.6k
                UInt32 to_max_digits = 0;
143
39.6k
                UInt32 to_precision = 0;
144
39.6k
                UInt32 to_scale = 0;
145
146
39.6k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
39.6k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
39.6k
                    const auto* to_decimal_type =
150
39.6k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
39.6k
                    to_precision = to_decimal_type->get_precision();
152
39.6k
                    ToDataType::check_type_precision(to_precision);
153
154
39.6k
                    to_scale = to_decimal_type->get_scale();
155
39.6k
                    ToDataType::check_type_scale(to_scale);
156
39.6k
                }
157
39.6k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
39.6k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
39.6k
                    to_precision = to_max_digits;
160
39.6k
                }
161
162
39.6k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
39.6k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
39.6k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
39.6k
                if (to_scale > from_scale) {
167
39.6k
                    multiply_may_overflow &=
168
39.6k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
39.6k
                }
170
39.6k
                return narrow_integral || multiply_may_overflow;
171
39.6k
            }
172
39.6k
            return false;
173
39.6k
        });
174
39.6k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
110
5.41k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
5.41k
        using Types = std::decay_t<decltype(types)>;
112
5.41k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
5.41k
        return call_on_index_and_data_type<
120
5.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
5.41k
            using Types2 = std::decay_t<decltype(types2)>;
122
5.41k
            using FromDataType = typename Types2::LeftType;
123
5.41k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
5.41k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
5.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
5.41k
                return false;
127
5.41k
            }
128
5.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
5.41k
                using FromFieldType = typename FromDataType::FieldType;
130
5.41k
                using ToFieldType = typename ToDataType::FieldType;
131
5.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
5.41k
                UInt32 from_scale = 0;
133
134
5.41k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
5.41k
                    const auto* from_decimal_type =
136
5.41k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
5.41k
                    from_precision =
138
5.41k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
5.41k
                    from_scale = from_decimal_type->get_scale();
140
5.41k
                }
141
142
5.41k
                UInt32 to_max_digits = 0;
143
5.41k
                UInt32 to_precision = 0;
144
5.41k
                UInt32 to_scale = 0;
145
146
5.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
5.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
5.41k
                    const auto* to_decimal_type =
150
5.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
5.41k
                    to_precision = to_decimal_type->get_precision();
152
5.41k
                    ToDataType::check_type_precision(to_precision);
153
154
5.41k
                    to_scale = to_decimal_type->get_scale();
155
5.41k
                    ToDataType::check_type_scale(to_scale);
156
5.41k
                }
157
5.41k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
5.41k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
5.41k
                    to_precision = to_max_digits;
160
5.41k
                }
161
162
5.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
5.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
5.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
5.41k
                if (to_scale > from_scale) {
167
5.41k
                    multiply_may_overflow &=
168
5.41k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
5.41k
                }
170
5.41k
                return narrow_integral || multiply_may_overflow;
171
5.41k
            }
172
5.41k
            return false;
173
5.41k
        });
174
5.41k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
110
10.8k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
10.8k
        using Types = std::decay_t<decltype(types)>;
112
10.8k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
10.8k
        return call_on_index_and_data_type<
120
10.8k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
10.8k
            using Types2 = std::decay_t<decltype(types2)>;
122
10.8k
            using FromDataType = typename Types2::LeftType;
123
10.8k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
10.8k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
10.8k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
10.8k
                return false;
127
10.8k
            }
128
10.8k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
10.8k
                using FromFieldType = typename FromDataType::FieldType;
130
10.8k
                using ToFieldType = typename ToDataType::FieldType;
131
10.8k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
10.8k
                UInt32 from_scale = 0;
133
134
10.8k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
10.8k
                    const auto* from_decimal_type =
136
10.8k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
10.8k
                    from_precision =
138
10.8k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
10.8k
                    from_scale = from_decimal_type->get_scale();
140
10.8k
                }
141
142
10.8k
                UInt32 to_max_digits = 0;
143
10.8k
                UInt32 to_precision = 0;
144
10.8k
                UInt32 to_scale = 0;
145
146
10.8k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
10.8k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
10.8k
                    const auto* to_decimal_type =
150
10.8k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
10.8k
                    to_precision = to_decimal_type->get_precision();
152
10.8k
                    ToDataType::check_type_precision(to_precision);
153
154
10.8k
                    to_scale = to_decimal_type->get_scale();
155
10.8k
                    ToDataType::check_type_scale(to_scale);
156
10.8k
                }
157
10.8k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
10.8k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
10.8k
                    to_precision = to_max_digits;
160
10.8k
                }
161
162
10.8k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
10.8k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
10.8k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
10.8k
                if (to_scale > from_scale) {
167
10.8k
                    multiply_may_overflow &=
168
10.8k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
10.8k
                }
170
10.8k
                return narrow_integral || multiply_may_overflow;
171
10.8k
            }
172
10.8k
            return false;
173
10.8k
        });
174
10.8k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
110
27.1k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
27.1k
        using Types = std::decay_t<decltype(types)>;
112
27.1k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
27.1k
        return call_on_index_and_data_type<
120
27.1k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
27.1k
            using Types2 = std::decay_t<decltype(types2)>;
122
27.1k
            using FromDataType = typename Types2::LeftType;
123
27.1k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
27.1k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
27.1k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
27.1k
                return false;
127
27.1k
            }
128
27.1k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
27.1k
                using FromFieldType = typename FromDataType::FieldType;
130
27.1k
                using ToFieldType = typename ToDataType::FieldType;
131
27.1k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
27.1k
                UInt32 from_scale = 0;
133
134
27.1k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
27.1k
                    const auto* from_decimal_type =
136
27.1k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
27.1k
                    from_precision =
138
27.1k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
27.1k
                    from_scale = from_decimal_type->get_scale();
140
27.1k
                }
141
142
27.1k
                UInt32 to_max_digits = 0;
143
27.1k
                UInt32 to_precision = 0;
144
27.1k
                UInt32 to_scale = 0;
145
146
27.1k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
27.1k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
27.1k
                    const auto* to_decimal_type =
150
27.1k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
27.1k
                    to_precision = to_decimal_type->get_precision();
152
27.1k
                    ToDataType::check_type_precision(to_precision);
153
154
27.1k
                    to_scale = to_decimal_type->get_scale();
155
27.1k
                    ToDataType::check_type_scale(to_scale);
156
27.1k
                }
157
27.1k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
27.1k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
27.1k
                    to_precision = to_max_digits;
160
27.1k
                }
161
162
27.1k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
27.1k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
27.1k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
27.1k
                if (to_scale > from_scale) {
167
27.1k
                    multiply_may_overflow &=
168
27.1k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
27.1k
                }
170
27.1k
                return narrow_integral || multiply_may_overflow;
171
27.1k
            }
172
27.1k
            return false;
173
27.1k
        });
174
27.1k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
110
7.97k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
7.97k
        using Types = std::decay_t<decltype(types)>;
112
7.97k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
7.97k
        return call_on_index_and_data_type<
120
7.97k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7.97k
            using Types2 = std::decay_t<decltype(types2)>;
122
7.97k
            using FromDataType = typename Types2::LeftType;
123
7.97k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
7.97k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
7.97k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
7.97k
                return false;
127
7.97k
            }
128
7.97k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
7.97k
                using FromFieldType = typename FromDataType::FieldType;
130
7.97k
                using ToFieldType = typename ToDataType::FieldType;
131
7.97k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
7.97k
                UInt32 from_scale = 0;
133
134
7.97k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
7.97k
                    const auto* from_decimal_type =
136
7.97k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
7.97k
                    from_precision =
138
7.97k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
7.97k
                    from_scale = from_decimal_type->get_scale();
140
7.97k
                }
141
142
7.97k
                UInt32 to_max_digits = 0;
143
7.97k
                UInt32 to_precision = 0;
144
7.97k
                UInt32 to_scale = 0;
145
146
7.97k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
7.97k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
7.97k
                    const auto* to_decimal_type =
150
7.97k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
7.97k
                    to_precision = to_decimal_type->get_precision();
152
7.97k
                    ToDataType::check_type_precision(to_precision);
153
154
7.97k
                    to_scale = to_decimal_type->get_scale();
155
7.97k
                    ToDataType::check_type_scale(to_scale);
156
7.97k
                }
157
7.97k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
7.97k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
7.97k
                    to_precision = to_max_digits;
160
7.97k
                }
161
162
7.97k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
7.97k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
7.97k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
7.97k
                if (to_scale > from_scale) {
167
7.97k
                    multiply_may_overflow &=
168
7.97k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
7.97k
                }
170
7.97k
                return narrow_integral || multiply_may_overflow;
171
7.97k
            }
172
7.97k
            return false;
173
7.97k
        });
174
7.97k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
110
21.6k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
21.6k
        using Types = std::decay_t<decltype(types)>;
112
21.6k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
21.6k
        return call_on_index_and_data_type<
120
21.6k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
21.6k
            using Types2 = std::decay_t<decltype(types2)>;
122
21.6k
            using FromDataType = typename Types2::LeftType;
123
21.6k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
21.6k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
21.6k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
21.6k
                return false;
127
21.6k
            }
128
21.6k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
21.6k
                using FromFieldType = typename FromDataType::FieldType;
130
21.6k
                using ToFieldType = typename ToDataType::FieldType;
131
21.6k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
21.6k
                UInt32 from_scale = 0;
133
134
21.6k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
21.6k
                    const auto* from_decimal_type =
136
21.6k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
21.6k
                    from_precision =
138
21.6k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
21.6k
                    from_scale = from_decimal_type->get_scale();
140
21.6k
                }
141
142
21.6k
                UInt32 to_max_digits = 0;
143
21.6k
                UInt32 to_precision = 0;
144
21.6k
                UInt32 to_scale = 0;
145
146
21.6k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
21.6k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
21.6k
                    const auto* to_decimal_type =
150
21.6k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
21.6k
                    to_precision = to_decimal_type->get_precision();
152
21.6k
                    ToDataType::check_type_precision(to_precision);
153
154
21.6k
                    to_scale = to_decimal_type->get_scale();
155
21.6k
                    ToDataType::check_type_scale(to_scale);
156
21.6k
                }
157
21.6k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
21.6k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
21.6k
                    to_precision = to_max_digits;
160
21.6k
                }
161
162
21.6k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
21.6k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
21.6k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
21.6k
                if (to_scale > from_scale) {
167
21.6k
                    multiply_may_overflow &=
168
21.6k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
21.6k
                }
170
21.6k
                return narrow_integral || multiply_may_overflow;
171
21.6k
            }
172
21.6k
            return false;
173
21.6k
        });
174
21.6k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
110
227
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
227
        using Types = std::decay_t<decltype(types)>;
112
227
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
227
        return call_on_index_and_data_type<
120
227
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
227
            using Types2 = std::decay_t<decltype(types2)>;
122
227
            using FromDataType = typename Types2::LeftType;
123
227
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
227
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
227
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
227
                return false;
127
227
            }
128
227
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
227
                using FromFieldType = typename FromDataType::FieldType;
130
227
                using ToFieldType = typename ToDataType::FieldType;
131
227
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
227
                UInt32 from_scale = 0;
133
134
227
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
227
                    const auto* from_decimal_type =
136
227
                            check_and_get_data_type<FromDataType>(from_type.get());
137
227
                    from_precision =
138
227
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
227
                    from_scale = from_decimal_type->get_scale();
140
227
                }
141
142
227
                UInt32 to_max_digits = 0;
143
227
                UInt32 to_precision = 0;
144
227
                UInt32 to_scale = 0;
145
146
227
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
227
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
227
                    const auto* to_decimal_type =
150
227
                            check_and_get_data_type<ToDataType>(to_type.get());
151
227
                    to_precision = to_decimal_type->get_precision();
152
227
                    ToDataType::check_type_precision(to_precision);
153
154
227
                    to_scale = to_decimal_type->get_scale();
155
227
                    ToDataType::check_type_scale(to_scale);
156
227
                }
157
227
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
227
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
227
                    to_precision = to_max_digits;
160
227
                }
161
162
227
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
227
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
227
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
227
                if (to_scale > from_scale) {
167
227
                    multiply_may_overflow &=
168
227
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
227
                }
170
227
                return narrow_integral || multiply_may_overflow;
171
227
            }
172
227
            return false;
173
227
        });
174
227
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
110
16.2k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
16.2k
        using Types = std::decay_t<decltype(types)>;
112
16.2k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
16.2k
        return call_on_index_and_data_type<
120
16.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
16.2k
            using Types2 = std::decay_t<decltype(types2)>;
122
16.2k
            using FromDataType = typename Types2::LeftType;
123
16.2k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
16.2k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
16.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
16.2k
                return false;
127
16.2k
            }
128
16.2k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
16.2k
                using FromFieldType = typename FromDataType::FieldType;
130
16.2k
                using ToFieldType = typename ToDataType::FieldType;
131
16.2k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
16.2k
                UInt32 from_scale = 0;
133
134
16.2k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
16.2k
                    const auto* from_decimal_type =
136
16.2k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
16.2k
                    from_precision =
138
16.2k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
16.2k
                    from_scale = from_decimal_type->get_scale();
140
16.2k
                }
141
142
16.2k
                UInt32 to_max_digits = 0;
143
16.2k
                UInt32 to_precision = 0;
144
16.2k
                UInt32 to_scale = 0;
145
146
16.2k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
16.2k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
16.2k
                    const auto* to_decimal_type =
150
16.2k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
16.2k
                    to_precision = to_decimal_type->get_precision();
152
16.2k
                    ToDataType::check_type_precision(to_precision);
153
154
16.2k
                    to_scale = to_decimal_type->get_scale();
155
16.2k
                    ToDataType::check_type_scale(to_scale);
156
16.2k
                }
157
16.2k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
16.2k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
16.2k
                    to_precision = to_max_digits;
160
16.2k
                }
161
162
16.2k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
16.2k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
16.2k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
16.2k
                if (to_scale > from_scale) {
167
16.2k
                    multiply_may_overflow &=
168
16.2k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
16.2k
                }
170
16.2k
                return narrow_integral || multiply_may_overflow;
171
16.2k
            }
172
16.2k
            return false;
173
16.2k
        });
174
16.2k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_
Line
Count
Source
110
10.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
10.9k
        using Types = std::decay_t<decltype(types)>;
112
10.9k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
10.9k
        return call_on_index_and_data_type<
120
10.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
10.9k
            using Types2 = std::decay_t<decltype(types2)>;
122
10.9k
            using FromDataType = typename Types2::LeftType;
123
10.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
10.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
10.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
10.9k
                return false;
127
10.9k
            }
128
10.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
10.9k
                using FromFieldType = typename FromDataType::FieldType;
130
10.9k
                using ToFieldType = typename ToDataType::FieldType;
131
10.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
10.9k
                UInt32 from_scale = 0;
133
134
10.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
10.9k
                    const auto* from_decimal_type =
136
10.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
10.9k
                    from_precision =
138
10.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
10.9k
                    from_scale = from_decimal_type->get_scale();
140
10.9k
                }
141
142
10.9k
                UInt32 to_max_digits = 0;
143
10.9k
                UInt32 to_precision = 0;
144
10.9k
                UInt32 to_scale = 0;
145
146
10.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
10.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
10.9k
                    const auto* to_decimal_type =
150
10.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
10.9k
                    to_precision = to_decimal_type->get_precision();
152
10.9k
                    ToDataType::check_type_precision(to_precision);
153
154
10.9k
                    to_scale = to_decimal_type->get_scale();
155
10.9k
                    ToDataType::check_type_scale(to_scale);
156
10.9k
                }
157
10.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
10.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
10.9k
                    to_precision = to_max_digits;
160
10.9k
                }
161
162
10.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
10.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
10.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
10.9k
                if (to_scale > from_scale) {
167
10.9k
                    multiply_may_overflow &=
168
10.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
10.9k
                }
170
10.9k
                return narrow_integral || multiply_may_overflow;
171
10.9k
            }
172
10.9k
            return false;
173
10.9k
        });
174
10.9k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_
Line
Count
Source
110
30
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
30
        using Types = std::decay_t<decltype(types)>;
112
30
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
30
        return call_on_index_and_data_type<
120
30
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
30
            using Types2 = std::decay_t<decltype(types2)>;
122
30
            using FromDataType = typename Types2::LeftType;
123
30
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
30
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
30
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
30
                return false;
127
30
            }
128
30
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
30
                using FromFieldType = typename FromDataType::FieldType;
130
30
                using ToFieldType = typename ToDataType::FieldType;
131
30
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
30
                UInt32 from_scale = 0;
133
134
30
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
30
                    const auto* from_decimal_type =
136
30
                            check_and_get_data_type<FromDataType>(from_type.get());
137
30
                    from_precision =
138
30
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
30
                    from_scale = from_decimal_type->get_scale();
140
30
                }
141
142
30
                UInt32 to_max_digits = 0;
143
30
                UInt32 to_precision = 0;
144
30
                UInt32 to_scale = 0;
145
146
30
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
30
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
30
                    const auto* to_decimal_type =
150
30
                            check_and_get_data_type<ToDataType>(to_type.get());
151
30
                    to_precision = to_decimal_type->get_precision();
152
30
                    ToDataType::check_type_precision(to_precision);
153
154
30
                    to_scale = to_decimal_type->get_scale();
155
30
                    ToDataType::check_type_scale(to_scale);
156
30
                }
157
30
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
30
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
30
                    to_precision = to_max_digits;
160
30
                }
161
162
30
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
30
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
30
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
30
                if (to_scale > from_scale) {
167
30
                    multiply_may_overflow &=
168
30
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
30
                }
170
30
                return narrow_integral || multiply_may_overflow;
171
30
            }
172
30
            return false;
173
30
        });
174
30
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_
Line
Count
Source
110
7.30k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
7.30k
        using Types = std::decay_t<decltype(types)>;
112
7.30k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
7.30k
        return call_on_index_and_data_type<
120
7.30k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7.30k
            using Types2 = std::decay_t<decltype(types2)>;
122
7.30k
            using FromDataType = typename Types2::LeftType;
123
7.30k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
7.30k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
7.30k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
7.30k
                return false;
127
7.30k
            }
128
7.30k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
7.30k
                using FromFieldType = typename FromDataType::FieldType;
130
7.30k
                using ToFieldType = typename ToDataType::FieldType;
131
7.30k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
7.30k
                UInt32 from_scale = 0;
133
134
7.30k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
7.30k
                    const auto* from_decimal_type =
136
7.30k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
7.30k
                    from_precision =
138
7.30k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
7.30k
                    from_scale = from_decimal_type->get_scale();
140
7.30k
                }
141
142
7.30k
                UInt32 to_max_digits = 0;
143
7.30k
                UInt32 to_precision = 0;
144
7.30k
                UInt32 to_scale = 0;
145
146
7.30k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
7.30k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
7.30k
                    const auto* to_decimal_type =
150
7.30k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
7.30k
                    to_precision = to_decimal_type->get_precision();
152
7.30k
                    ToDataType::check_type_precision(to_precision);
153
154
7.30k
                    to_scale = to_decimal_type->get_scale();
155
7.30k
                    ToDataType::check_type_scale(to_scale);
156
7.30k
                }
157
7.30k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
7.30k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
7.30k
                    to_precision = to_max_digits;
160
7.30k
                }
161
162
7.30k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
7.30k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
7.30k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
7.30k
                if (to_scale > from_scale) {
167
7.30k
                    multiply_may_overflow &=
168
7.30k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
7.30k
                }
170
7.30k
                return narrow_integral || multiply_may_overflow;
171
7.30k
            }
172
7.30k
            return false;
173
7.30k
        });
174
7.30k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
110
4.69k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
4.69k
        using Types = std::decay_t<decltype(types)>;
112
4.69k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
4.69k
        return call_on_index_and_data_type<
120
4.69k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
4.69k
            using Types2 = std::decay_t<decltype(types2)>;
122
4.69k
            using FromDataType = typename Types2::LeftType;
123
4.69k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
4.69k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
4.69k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
4.69k
                return false;
127
4.69k
            }
128
4.69k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
4.69k
                using FromFieldType = typename FromDataType::FieldType;
130
4.69k
                using ToFieldType = typename ToDataType::FieldType;
131
4.69k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
4.69k
                UInt32 from_scale = 0;
133
134
4.69k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
4.69k
                    const auto* from_decimal_type =
136
4.69k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
4.69k
                    from_precision =
138
4.69k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
4.69k
                    from_scale = from_decimal_type->get_scale();
140
4.69k
                }
141
142
4.69k
                UInt32 to_max_digits = 0;
143
4.69k
                UInt32 to_precision = 0;
144
4.69k
                UInt32 to_scale = 0;
145
146
4.69k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
4.69k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
4.69k
                    const auto* to_decimal_type =
150
4.69k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
4.69k
                    to_precision = to_decimal_type->get_precision();
152
4.69k
                    ToDataType::check_type_precision(to_precision);
153
154
4.69k
                    to_scale = to_decimal_type->get_scale();
155
4.69k
                    ToDataType::check_type_scale(to_scale);
156
4.69k
                }
157
4.69k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
4.69k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
4.69k
                    to_precision = to_max_digits;
160
4.69k
                }
161
162
4.69k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
4.69k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
4.69k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
4.69k
                if (to_scale > from_scale) {
167
4.69k
                    multiply_may_overflow &=
168
4.69k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
4.69k
                }
170
4.69k
                return narrow_integral || multiply_may_overflow;
171
4.69k
            }
172
4.69k
            return false;
173
4.69k
        });
174
4.69k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_
Line
Count
Source
110
25
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
25
        using Types = std::decay_t<decltype(types)>;
112
25
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
25
        return call_on_index_and_data_type<
120
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
25
            using Types2 = std::decay_t<decltype(types2)>;
122
25
            using FromDataType = typename Types2::LeftType;
123
25
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
25
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
25
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
25
                return false;
127
25
            }
128
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
25
                using FromFieldType = typename FromDataType::FieldType;
130
25
                using ToFieldType = typename ToDataType::FieldType;
131
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
25
                UInt32 from_scale = 0;
133
134
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
25
                    const auto* from_decimal_type =
136
25
                            check_and_get_data_type<FromDataType>(from_type.get());
137
25
                    from_precision =
138
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
25
                    from_scale = from_decimal_type->get_scale();
140
25
                }
141
142
25
                UInt32 to_max_digits = 0;
143
25
                UInt32 to_precision = 0;
144
25
                UInt32 to_scale = 0;
145
146
25
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
25
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
25
                    const auto* to_decimal_type =
150
25
                            check_and_get_data_type<ToDataType>(to_type.get());
151
25
                    to_precision = to_decimal_type->get_precision();
152
25
                    ToDataType::check_type_precision(to_precision);
153
154
25
                    to_scale = to_decimal_type->get_scale();
155
25
                    ToDataType::check_type_scale(to_scale);
156
25
                }
157
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
25
                    to_precision = to_max_digits;
160
25
                }
161
162
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
25
                if (to_scale > from_scale) {
167
25
                    multiply_may_overflow &=
168
25
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
25
                }
170
25
                return narrow_integral || multiply_may_overflow;
171
25
            }
172
25
            return false;
173
25
        });
174
25
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_
Line
Count
Source
110
460
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
460
        using Types = std::decay_t<decltype(types)>;
112
460
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
460
        return call_on_index_and_data_type<
120
460
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
460
            using Types2 = std::decay_t<decltype(types2)>;
122
460
            using FromDataType = typename Types2::LeftType;
123
460
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
460
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
460
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
460
                return false;
127
460
            }
128
460
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
460
                using FromFieldType = typename FromDataType::FieldType;
130
460
                using ToFieldType = typename ToDataType::FieldType;
131
460
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
460
                UInt32 from_scale = 0;
133
134
460
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
460
                    const auto* from_decimal_type =
136
460
                            check_and_get_data_type<FromDataType>(from_type.get());
137
460
                    from_precision =
138
460
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
460
                    from_scale = from_decimal_type->get_scale();
140
460
                }
141
142
460
                UInt32 to_max_digits = 0;
143
460
                UInt32 to_precision = 0;
144
460
                UInt32 to_scale = 0;
145
146
460
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
460
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
460
                    const auto* to_decimal_type =
150
460
                            check_and_get_data_type<ToDataType>(to_type.get());
151
460
                    to_precision = to_decimal_type->get_precision();
152
460
                    ToDataType::check_type_precision(to_precision);
153
154
460
                    to_scale = to_decimal_type->get_scale();
155
460
                    ToDataType::check_type_scale(to_scale);
156
460
                }
157
460
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
460
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
460
                    to_precision = to_max_digits;
160
460
                }
161
162
460
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
460
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
460
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
460
                if (to_scale > from_scale) {
167
460
                    multiply_may_overflow &=
168
460
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
460
                }
170
460
                return narrow_integral || multiply_may_overflow;
171
460
            }
172
460
            return false;
173
460
        });
174
460
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_
Line
Count
Source
110
462
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
462
        using Types = std::decay_t<decltype(types)>;
112
462
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
462
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
462
            return false;
118
462
        }
119
0
        return call_on_index_and_data_type<
120
462
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
462
            using Types2 = std::decay_t<decltype(types2)>;
122
462
            using FromDataType = typename Types2::LeftType;
123
462
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
462
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
462
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
462
                return false;
127
462
            }
128
462
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
462
                using FromFieldType = typename FromDataType::FieldType;
130
462
                using ToFieldType = typename ToDataType::FieldType;
131
462
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
462
                UInt32 from_scale = 0;
133
134
462
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
462
                    const auto* from_decimal_type =
136
462
                            check_and_get_data_type<FromDataType>(from_type.get());
137
462
                    from_precision =
138
462
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
462
                    from_scale = from_decimal_type->get_scale();
140
462
                }
141
142
462
                UInt32 to_max_digits = 0;
143
462
                UInt32 to_precision = 0;
144
462
                UInt32 to_scale = 0;
145
146
462
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
462
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
462
                    const auto* to_decimal_type =
150
462
                            check_and_get_data_type<ToDataType>(to_type.get());
151
462
                    to_precision = to_decimal_type->get_precision();
152
462
                    ToDataType::check_type_precision(to_precision);
153
154
462
                    to_scale = to_decimal_type->get_scale();
155
462
                    ToDataType::check_type_scale(to_scale);
156
462
                }
157
462
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
462
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
462
                    to_precision = to_max_digits;
160
462
                }
161
162
462
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
462
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
462
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
462
                if (to_scale > from_scale) {
167
462
                    multiply_may_overflow &=
168
462
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
462
                }
170
462
                return narrow_integral || multiply_may_overflow;
171
462
            }
172
462
            return false;
173
462
        });
174
462
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_
Line
Count
Source
110
625
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
625
        using Types = std::decay_t<decltype(types)>;
112
625
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
625
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
625
            return false;
118
625
        }
119
0
        return call_on_index_and_data_type<
120
625
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
625
            using Types2 = std::decay_t<decltype(types2)>;
122
625
            using FromDataType = typename Types2::LeftType;
123
625
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
625
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
625
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
625
                return false;
127
625
            }
128
625
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
625
                using FromFieldType = typename FromDataType::FieldType;
130
625
                using ToFieldType = typename ToDataType::FieldType;
131
625
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
625
                UInt32 from_scale = 0;
133
134
625
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
625
                    const auto* from_decimal_type =
136
625
                            check_and_get_data_type<FromDataType>(from_type.get());
137
625
                    from_precision =
138
625
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
625
                    from_scale = from_decimal_type->get_scale();
140
625
                }
141
142
625
                UInt32 to_max_digits = 0;
143
625
                UInt32 to_precision = 0;
144
625
                UInt32 to_scale = 0;
145
146
625
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
625
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
625
                    const auto* to_decimal_type =
150
625
                            check_and_get_data_type<ToDataType>(to_type.get());
151
625
                    to_precision = to_decimal_type->get_precision();
152
625
                    ToDataType::check_type_precision(to_precision);
153
154
625
                    to_scale = to_decimal_type->get_scale();
155
625
                    ToDataType::check_type_scale(to_scale);
156
625
                }
157
625
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
625
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
625
                    to_precision = to_max_digits;
160
625
                }
161
162
625
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
625
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
625
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
625
                if (to_scale > from_scale) {
167
625
                    multiply_may_overflow &=
168
625
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
625
                }
170
625
                return narrow_integral || multiply_may_overflow;
171
625
            }
172
625
            return false;
173
625
        });
174
625
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_
Line
Count
Source
110
290
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
290
        using Types = std::decay_t<decltype(types)>;
112
290
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
290
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
290
            return false;
118
290
        }
119
0
        return call_on_index_and_data_type<
120
290
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
290
            using Types2 = std::decay_t<decltype(types2)>;
122
290
            using FromDataType = typename Types2::LeftType;
123
290
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
290
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
290
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
290
                return false;
127
290
            }
128
290
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
290
                using FromFieldType = typename FromDataType::FieldType;
130
290
                using ToFieldType = typename ToDataType::FieldType;
131
290
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
290
                UInt32 from_scale = 0;
133
134
290
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
290
                    const auto* from_decimal_type =
136
290
                            check_and_get_data_type<FromDataType>(from_type.get());
137
290
                    from_precision =
138
290
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
290
                    from_scale = from_decimal_type->get_scale();
140
290
                }
141
142
290
                UInt32 to_max_digits = 0;
143
290
                UInt32 to_precision = 0;
144
290
                UInt32 to_scale = 0;
145
146
290
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
290
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
290
                    const auto* to_decimal_type =
150
290
                            check_and_get_data_type<ToDataType>(to_type.get());
151
290
                    to_precision = to_decimal_type->get_precision();
152
290
                    ToDataType::check_type_precision(to_precision);
153
154
290
                    to_scale = to_decimal_type->get_scale();
155
290
                    ToDataType::check_type_scale(to_scale);
156
290
                }
157
290
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
290
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
290
                    to_precision = to_max_digits;
160
290
                }
161
162
290
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
290
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
290
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
290
                if (to_scale > from_scale) {
167
290
                    multiply_may_overflow &=
168
290
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
290
                }
170
290
                return narrow_integral || multiply_may_overflow;
171
290
            }
172
290
            return false;
173
290
        });
174
290
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_
Line
Count
Source
110
37.3k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
37.3k
        using Types = std::decay_t<decltype(types)>;
112
37.3k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
37.3k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
37.3k
            return false;
118
37.3k
        }
119
0
        return call_on_index_and_data_type<
120
37.3k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
37.3k
            using Types2 = std::decay_t<decltype(types2)>;
122
37.3k
            using FromDataType = typename Types2::LeftType;
123
37.3k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
37.3k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
37.3k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
37.3k
                return false;
127
37.3k
            }
128
37.3k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
37.3k
                using FromFieldType = typename FromDataType::FieldType;
130
37.3k
                using ToFieldType = typename ToDataType::FieldType;
131
37.3k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
37.3k
                UInt32 from_scale = 0;
133
134
37.3k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
37.3k
                    const auto* from_decimal_type =
136
37.3k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
37.3k
                    from_precision =
138
37.3k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
37.3k
                    from_scale = from_decimal_type->get_scale();
140
37.3k
                }
141
142
37.3k
                UInt32 to_max_digits = 0;
143
37.3k
                UInt32 to_precision = 0;
144
37.3k
                UInt32 to_scale = 0;
145
146
37.3k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
37.3k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
37.3k
                    const auto* to_decimal_type =
150
37.3k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
37.3k
                    to_precision = to_decimal_type->get_precision();
152
37.3k
                    ToDataType::check_type_precision(to_precision);
153
154
37.3k
                    to_scale = to_decimal_type->get_scale();
155
37.3k
                    ToDataType::check_type_scale(to_scale);
156
37.3k
                }
157
37.3k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
37.3k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
37.3k
                    to_precision = to_max_digits;
160
37.3k
                }
161
162
37.3k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
37.3k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
37.3k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
37.3k
                if (to_scale > from_scale) {
167
37.3k
                    multiply_may_overflow &=
168
37.3k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
37.3k
                }
170
37.3k
                return narrow_integral || multiply_may_overflow;
171
37.3k
            }
172
37.3k
            return false;
173
37.3k
        });
174
37.3k
    };
175
176
324k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
177
395k
}
178
179
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
180
425k
                                    const DataTypePtr& to_type) {
181
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
182
425k
    bool result_is_nullable = to_type->is_nullable();
183
184
425k
    if (result_is_nullable) {
185
395k
        return [from_type, to_type](FunctionContext* context, Block& block,
186
395k
                                    const ColumnNumbers& arguments, uint32_t result,
187
395k
                                    size_t input_rows_count,
188
395k
                                    const NullMap::value_type* null_map = nullptr) {
189
395k
            auto from_type_not_nullable = remove_nullable(from_type);
190
395k
            auto to_type_not_nullable = remove_nullable(to_type);
191
192
395k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
193
395k
                    context, from_type_not_nullable, to_type_not_nullable);
194
195
395k
            auto nested_result_index = block.columns();
196
395k
            block.insert(block.get_by_position(result).unnest_nullable());
197
395k
            auto nested_source_index = block.columns();
198
395k
            block.insert(block.get_by_position(arguments[0])
199
395k
                                 .unnest_nullable(replace_null_data_to_default));
200
201
395k
            const auto& arg_col = block.get_by_position(arguments[0]);
202
395k
            const NullMap::value_type* arg_null_map = nullptr;
203
395k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
204
341k
                arg_null_map = nullable->get_null_map_data().data();
205
341k
            }
206
395k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
207
395k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
208
395k
                    arg_null_map));
209
210
369k
            block.get_by_position(result).column =
211
369k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
212
369k
                                     arguments, input_rows_count);
213
214
369k
            block.erase(nested_source_index);
215
369k
            block.erase(nested_result_index);
216
369k
            return Status::OK();
217
395k
        };
218
395k
    } else {
219
30.8k
        return prepare_impl(context, from_type, to_type);
220
30.8k
    }
221
425k
}
222
223
/// 'from_type' and 'to_type' are nested types in case of Nullable.
224
/// 'requested_result_is_nullable' is true if CAST to Nullable type is requested.
225
WrapperType prepare_impl(FunctionContext* context, const DataTypePtr& origin_from_type,
226
438k
                         const DataTypePtr& origin_to_type) {
227
438k
    auto to_type = get_serialized_type(origin_to_type);
228
438k
    auto from_type = get_serialized_type(origin_from_type);
229
438k
    if (from_type->equals(*to_type)) {
230
76.3k
        return create_identity_wrapper(from_type);
231
76.3k
    }
232
233
    // variant needs to be judged first
234
362k
    if (to_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
235
11.7k
        return create_cast_to_variant_wrapper(from_type,
236
11.7k
                                              static_cast<const DataTypeVariant&>(*to_type));
237
11.7k
    }
238
350k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
239
15.0k
        return create_cast_from_variant_wrapper(static_cast<const DataTypeVariant&>(*from_type),
240
15.0k
                                                to_type);
241
15.0k
    }
242
243
335k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
244
9.30k
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
245
9.30k
                                              to_type,
246
9.30k
                                              context ? context->jsonb_string_as_string() : false);
247
9.30k
    }
248
249
326k
    switch (to_type->get_primitive_type()) {
250
1.04k
    case PrimitiveType::TYPE_BOOLEAN:
251
1.04k
        return create_boolean_wrapper(context, from_type);
252
5.07k
    case PrimitiveType::TYPE_TINYINT:
253
10.7k
    case PrimitiveType::TYPE_SMALLINT:
254
40.8k
    case PrimitiveType::TYPE_INT:
255
86.2k
    case PrimitiveType::TYPE_BIGINT:
256
91.1k
    case PrimitiveType::TYPE_LARGEINT:
257
91.1k
        return create_int_wrapper(context, from_type, to_type->get_primitive_type());
258
10.9k
    case PrimitiveType::TYPE_FLOAT:
259
41.4k
    case PrimitiveType::TYPE_DOUBLE:
260
41.4k
        return create_float_wrapper(context, from_type, to_type->get_primitive_type());
261
30
    case PrimitiveType::TYPE_DATE:
262
55
    case PrimitiveType::TYPE_DATETIME:
263
7.33k
    case PrimitiveType::TYPE_DATEV2:
264
12.4k
    case PrimitiveType::TYPE_DATETIMEV2:
265
12.8k
    case PrimitiveType::TYPE_TIMEV2:
266
12.8k
        return create_datelike_wrapper(context, from_type, to_type->get_primitive_type());
267
462
    case PrimitiveType::TYPE_TIMESTAMPTZ:
268
462
        return create_timestamptz_wrapper(context, from_type);
269
481
    case PrimitiveType::TYPE_IPV4:
270
771
    case PrimitiveType::TYPE_IPV6:
271
771
        return create_ip_wrapper(context, from_type, to_type->get_primitive_type());
272
291
    case PrimitiveType::TYPE_DECIMALV2:
273
8.35k
    case PrimitiveType::TYPE_DECIMAL32:
274
34.1k
    case PrimitiveType::TYPE_DECIMAL64:
275
53.5k
    case PrimitiveType::TYPE_DECIMAL128I:
276
64.5k
    case PrimitiveType::TYPE_DECIMAL256:
277
64.5k
        return create_decimal_wrapper(context, from_type, to_type->get_primitive_type());
278
34
    case PrimitiveType::TYPE_CHAR:
279
6.98k
    case PrimitiveType::TYPE_VARCHAR:
280
34.3k
    case PrimitiveType::TYPE_STRING:
281
34.3k
        return create_string_wrapper(from_type);
282
14.9k
    case PrimitiveType::TYPE_ARRAY:
283
14.9k
        return create_array_wrapper(context, from_type,
284
14.9k
                                    static_cast<const DataTypeArray&>(*to_type));
285
3.11k
    case PrimitiveType::TYPE_STRUCT:
286
3.11k
        return create_struct_wrapper(context, from_type,
287
3.11k
                                     static_cast<const DataTypeStruct&>(*to_type));
288
2.54k
    case PrimitiveType::TYPE_MAP:
289
2.54k
        return create_map_wrapper(context, from_type, static_cast<const DataTypeMap&>(*to_type));
290
6
    case PrimitiveType::TYPE_HLL:
291
6
        return create_hll_wrapper(context, from_type, static_cast<const DataTypeHLL&>(*to_type));
292
5
    case PrimitiveType::TYPE_BITMAP:
293
5
        return create_bitmap_wrapper(context, from_type,
294
5
                                     static_cast<const DataTypeBitMap&>(*to_type));
295
2
    case PrimitiveType::TYPE_QUANTILE_STATE:
296
2
        return create_quantile_state_wrapper(context, from_type,
297
2
                                             static_cast<const DataTypeQuantileState&>(*to_type));
298
59.2k
    case PrimitiveType::TYPE_JSONB:
299
59.2k
        return create_cast_to_jsonb_wrapper(from_type, static_cast<const DataTypeJsonb&>(*to_type),
300
59.2k
                                            context ? context->string_as_jsonb_string() : false);
301
2
    case PrimitiveType::TYPE_VARBINARY:
302
2
        return create_varbinary_wrapper(from_type);
303
0
    default:
304
0
        break;
305
326k
    }
306
307
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
308
326k
}
309
310
} // namespace CastWrapper
311
312
class PreparedFunctionCast : public PreparedFunctionImpl {
313
public:
314
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
315
410k
            : wrapper_function(std::move(wrapper_function_)), name(name_) {}
316
317
0
    String get_name() const override { return name; }
318
319
protected:
320
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
321
410k
                        uint32_t result, size_t input_rows_count) const override {
322
410k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
323
410k
    }
324
325
410k
    bool use_default_implementation_for_nulls() const override { return false; }
326
410k
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {1}; }
327
328
private:
329
    CastWrapper::WrapperType wrapper_function;
330
    const char* name;
331
};
332
333
class FunctionCast final : public IFunctionBase {
334
public:
335
    FunctionCast(const char* name_, DataTypes argument_types_, DataTypePtr return_type_)
336
309k
            : name(name_),
337
309k
              argument_types(std::move(argument_types_)),
338
309k
              return_type(std::move(return_type_)) {}
339
340
410k
    const DataTypes& get_argument_types() const override { return argument_types; }
341
410k
    const DataTypePtr& get_return_type() const override { return return_type; }
342
343
    PreparedFunctionPtr prepare(FunctionContext* context, const Block& /*sample_block*/,
344
                                const ColumnNumbers& /*arguments*/,
345
410k
                                uint32_t /*result*/) const override {
346
410k
        return std::make_shared<PreparedFunctionCast>(
347
410k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
348
410k
                                                         get_return_type()),
349
410k
                name);
350
410k
    }
351
352
0
    String get_name() const override { return name; }
353
354
0
    bool is_use_default_implementation_for_constants() const override { return true; }
355
356
private:
357
    const char* name = nullptr;
358
359
    DataTypes argument_types;
360
    DataTypePtr return_type;
361
};
362
363
class FunctionBuilderCast : public FunctionBuilderImpl {
364
public:
365
    static constexpr auto name = "CAST";
366
309k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
367
368
309k
    FunctionBuilderCast() = default;
369
370
1
    String get_name() const override { return name; }
371
372
0
    size_t get_number_of_arguments() const override { return 2; }
373
374
0
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {1}; }
375
376
protected:
377
    FunctionBasePtr build_impl(const ColumnsWithTypeAndName& arguments,
378
309k
                               const DataTypePtr& return_type) const override {
379
309k
        DataTypes data_types(arguments.size());
380
381
929k
        for (size_t i = 0; i < arguments.size(); ++i) {
382
619k
            data_types[i] = arguments[i].type;
383
619k
        }
384
385
309k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
386
309k
    }
387
388
309k
    bool skip_return_type_check() const override { return true; }
389
0
    DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override {
390
0
        return nullptr;
391
0
    }
392
393
0
    bool use_default_implementation_for_nulls() const override { return false; }
394
};
395
396
8
void register_function_cast(SimpleFunctionFactory& factory) {
397
8
    factory.register_function<FunctionBuilderCast>();
398
8
}
399
} // namespace doris