Coverage Report

Created: 2026-04-01 16:13

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
409k
                                        const DataTypePtr& to_type) {
80
409k
    const auto& from_nested = from_type;
81
409k
    const auto& to_nested = to_type;
82
83
409k
    if (from_type->is_null_literal()) {
84
2.14k
        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.14k
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
90
2.14k
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
91
            /// TODO: remove this in the future.
92
2.14k
            auto& res = block.get_by_position(result);
93
2.14k
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
94
2.14k
                                 ->convert_to_full_column_if_const();
95
2.14k
            return Status::OK();
96
2.14k
        };
97
2.14k
    }
98
99
407k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
100
101
407k
    return wrapper;
102
409k
}
103
104
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
105
377k
                                       const DataTypePtr& to_type) {
106
377k
    if (from_type->equals(*to_type)) {
107
69.0k
        return false;
108
69.0k
    }
109
110
308k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
228k
        using Types = std::decay_t<decltype(types)>;
112
228k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
34.7k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
34.7k
            return false;
118
34.7k
        }
119
0
        return call_on_index_and_data_type<
120
228k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
170k
            using Types2 = std::decay_t<decltype(types2)>;
122
170k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
86.4k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
86.4k
                return false;
127
86.4k
            }
128
55.2k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
55.2k
                using FromFieldType = typename FromDataType::FieldType;
130
55.2k
                using ToFieldType = typename ToDataType::FieldType;
131
55.2k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
55.2k
                UInt32 from_scale = 0;
133
134
55.2k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
23.5k
                    const auto* from_decimal_type =
136
23.5k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
23.5k
                    from_precision =
138
23.5k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
23.5k
                    from_scale = from_decimal_type->get_scale();
140
23.5k
                }
141
142
55.2k
                UInt32 to_max_digits = 0;
143
55.2k
                UInt32 to_precision = 0;
144
55.2k
                UInt32 to_scale = 0;
145
146
55.2k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
49.0k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
49.0k
                    const auto* to_decimal_type =
150
49.0k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
49.0k
                    to_precision = to_decimal_type->get_precision();
152
49.0k
                    ToDataType::check_type_precision(to_precision);
153
154
49.0k
                    to_scale = to_decimal_type->get_scale();
155
49.0k
                    ToDataType::check_type_scale(to_scale);
156
49.0k
                }
157
55.2k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
6.14k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
6.14k
                    to_precision = to_max_digits;
160
6.14k
                }
161
162
55.2k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
55.2k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
55.2k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
55.2k
                if (to_scale > from_scale) {
167
12.3k
                    multiply_may_overflow &=
168
12.3k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
12.3k
                }
170
55.2k
                return narrow_integral || multiply_may_overflow;
171
55.2k
            }
172
0
            return false;
173
170k
        });
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
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_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
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
            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
32
            return false;
173
32
        });
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
762
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
762
            using Types2 = std::decay_t<decltype(types2)>;
122
762
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
762
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
762
                return false;
127
762
            }
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
762
            return false;
173
762
        });
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
681
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
681
            using Types2 = std::decay_t<decltype(types2)>;
122
681
            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
681
            return false;
173
681
        });
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
271
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
271
            using Types2 = std::decay_t<decltype(types2)>;
122
271
            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
271
            return false;
173
271
        });
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
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
        });
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
1.57k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.57k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.57k
            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.57k
            return false;
173
1.57k
        });
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
253
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
253
            using Types2 = std::decay_t<decltype(types2)>;
122
253
            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
253
            return false;
173
253
        });
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
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_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
22
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
22
            using Types2 = std::decay_t<decltype(types2)>;
122
22
            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
22
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
22
                using FromFieldType = typename FromDataType::FieldType;
130
22
                using ToFieldType = typename ToDataType::FieldType;
131
22
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
22
                UInt32 from_scale = 0;
133
134
22
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
22
                    const auto* from_decimal_type =
136
22
                            check_and_get_data_type<FromDataType>(from_type.get());
137
22
                    from_precision =
138
22
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
22
                    from_scale = from_decimal_type->get_scale();
140
22
                }
141
142
22
                UInt32 to_max_digits = 0;
143
22
                UInt32 to_precision = 0;
144
22
                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
22
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
22
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
22
                    to_precision = to_max_digits;
160
22
                }
161
162
22
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
22
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
22
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
22
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
22
                return narrow_integral || multiply_may_overflow;
171
22
            }
172
0
            return false;
173
22
        });
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
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
        });
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
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_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.48k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2.48k
            using Types2 = std::decay_t<decltype(types2)>;
122
2.48k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
2.48k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
2.48k
                return false;
127
2.48k
            }
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.48k
            return false;
173
2.48k
        });
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
44
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
44
            using Types2 = std::decay_t<decltype(types2)>;
122
44
            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
44
            return false;
173
44
        });
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.48k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
3.48k
            using Types2 = std::decay_t<decltype(types2)>;
122
3.48k
            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.48k
            return false;
173
3.48k
        });
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
365
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
365
            using Types2 = std::decay_t<decltype(types2)>;
122
365
            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
365
            return false;
173
365
        });
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.56k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.56k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.56k
            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.56k
            return false;
173
1.56k
        });
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
37
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
37
            using Types2 = std::decay_t<decltype(types2)>;
122
37
            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
37
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
37
                using FromFieldType = typename FromDataType::FieldType;
130
37
                using ToFieldType = typename ToDataType::FieldType;
131
37
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
37
                UInt32 from_scale = 0;
133
134
37
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
37
                    const auto* from_decimal_type =
136
37
                            check_and_get_data_type<FromDataType>(from_type.get());
137
37
                    from_precision =
138
37
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
37
                    from_scale = from_decimal_type->get_scale();
140
37
                }
141
142
37
                UInt32 to_max_digits = 0;
143
37
                UInt32 to_precision = 0;
144
37
                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
37
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
37
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
37
                    to_precision = to_max_digits;
160
37
                }
161
162
37
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
37
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
37
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
37
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
37
                return narrow_integral || multiply_may_overflow;
171
37
            }
172
0
            return false;
173
37
        });
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
249
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
249
            using Types2 = std::decay_t<decltype(types2)>;
122
249
            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
249
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
249
                using FromFieldType = typename FromDataType::FieldType;
130
249
                using ToFieldType = typename ToDataType::FieldType;
131
249
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
249
                UInt32 from_scale = 0;
133
134
249
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
249
                    const auto* from_decimal_type =
136
249
                            check_and_get_data_type<FromDataType>(from_type.get());
137
249
                    from_precision =
138
249
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
249
                    from_scale = from_decimal_type->get_scale();
140
249
                }
141
142
249
                UInt32 to_max_digits = 0;
143
249
                UInt32 to_precision = 0;
144
249
                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
249
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
249
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
249
                    to_precision = to_max_digits;
160
249
                }
161
162
249
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
249
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
249
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
249
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
249
                return narrow_integral || multiply_may_overflow;
171
249
            }
172
0
            return false;
173
249
        });
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
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_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.0k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
18.0k
            using Types2 = std::decay_t<decltype(types2)>;
122
18.0k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
18.0k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
18.0k
                return false;
127
18.0k
            }
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.0k
            return false;
173
18.0k
        });
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
493
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
493
            using Types2 = std::decay_t<decltype(types2)>;
122
493
            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
493
            return false;
173
493
        });
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.27k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.27k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.27k
            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.27k
            return false;
173
1.27k
        });
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
656
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
656
            using Types2 = std::decay_t<decltype(types2)>;
122
656
            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
656
            return false;
173
656
        });
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.43k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7.43k
            using Types2 = std::decay_t<decltype(types2)>;
122
7.43k
            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.43k
            return false;
173
7.43k
        });
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
311
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
311
            using Types2 = std::decay_t<decltype(types2)>;
122
311
            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
311
            return false;
173
311
        });
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
640
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
640
            using Types2 = std::decay_t<decltype(types2)>;
122
640
            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
640
            return false;
173
640
        });
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
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
315
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
315
                using FromFieldType = typename FromDataType::FieldType;
130
315
                using ToFieldType = typename ToDataType::FieldType;
131
315
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
315
                UInt32 from_scale = 0;
133
134
315
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
315
                    const auto* from_decimal_type =
136
315
                            check_and_get_data_type<FromDataType>(from_type.get());
137
315
                    from_precision =
138
315
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
315
                    from_scale = from_decimal_type->get_scale();
140
315
                }
141
142
315
                UInt32 to_max_digits = 0;
143
315
                UInt32 to_precision = 0;
144
315
                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
315
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
315
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
315
                    to_precision = to_max_digits;
160
315
                }
161
162
315
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
315
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
315
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
315
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
317
                return narrow_integral || multiply_may_overflow;
171
315
            }
172
0
            return false;
173
315
        });
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
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
                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
303
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
303
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
303
                    to_precision = to_max_digits;
160
303
                }
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
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
303
                return narrow_integral || multiply_may_overflow;
171
303
            }
172
0
            return false;
173
303
        });
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.24k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.24k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.24k
            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.24k
            return false;
173
1.24k
        });
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.24k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.24k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.24k
            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.24k
            return false;
173
1.24k
        });
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
19.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
19.9k
            using Types2 = std::decay_t<decltype(types2)>;
122
19.9k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
19.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
19.9k
                return false;
127
19.9k
            }
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.9k
            return false;
173
19.9k
        });
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
138
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
138
            using Types2 = std::decay_t<decltype(types2)>;
122
138
            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
138
            return false;
173
138
        });
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
78
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
78
            using Types2 = std::decay_t<decltype(types2)>;
122
78
            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
78
            return false;
173
78
        });
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
566
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
566
            using Types2 = std::decay_t<decltype(types2)>;
122
566
            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
566
            return false;
173
566
        });
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
783
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
783
            using Types2 = std::decay_t<decltype(types2)>;
122
783
            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
783
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
783
                using FromFieldType = typename FromDataType::FieldType;
130
783
                using ToFieldType = typename ToDataType::FieldType;
131
783
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
783
                UInt32 from_scale = 0;
133
134
783
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
783
                    const auto* from_decimal_type =
136
783
                            check_and_get_data_type<FromDataType>(from_type.get());
137
783
                    from_precision =
138
783
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
783
                    from_scale = from_decimal_type->get_scale();
140
783
                }
141
142
783
                UInt32 to_max_digits = 0;
143
783
                UInt32 to_precision = 0;
144
783
                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
783
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
783
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
783
                    to_precision = to_max_digits;
160
783
                }
161
162
783
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
783
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
783
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
783
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
783
                return narrow_integral || multiply_may_overflow;
171
783
            }
172
0
            return false;
173
783
        });
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
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
        });
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
115
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
115
            using Types2 = std::decay_t<decltype(types2)>;
122
115
            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
115
            return false;
173
115
        });
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.62k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.62k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.62k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
1.62k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
1.62k
                return false;
127
1.62k
            }
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.62k
            return false;
173
1.62k
        });
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
296
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
296
            using Types2 = std::decay_t<decltype(types2)>;
122
296
            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
296
            return false;
173
296
        });
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
544
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
544
            using Types2 = std::decay_t<decltype(types2)>;
122
544
            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
544
            return false;
173
544
        });
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
989
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
989
            using Types2 = std::decay_t<decltype(types2)>;
122
989
            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
989
            return false;
173
989
        });
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.15k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.15k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.15k
            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.15k
            return false;
173
1.15k
        });
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.50k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.50k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.50k
            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.50k
            return false;
173
1.50k
        });
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.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
            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.20k
            return false;
173
1.20k
        });
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
506
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
506
            using Types2 = std::decay_t<decltype(types2)>;
122
506
            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
506
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
506
                using FromFieldType = typename FromDataType::FieldType;
130
506
                using ToFieldType = typename ToDataType::FieldType;
131
506
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
506
                UInt32 from_scale = 0;
133
134
506
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
506
                    const auto* from_decimal_type =
136
506
                            check_and_get_data_type<FromDataType>(from_type.get());
137
506
                    from_precision =
138
506
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
506
                    from_scale = from_decimal_type->get_scale();
140
506
                }
141
142
506
                UInt32 to_max_digits = 0;
143
506
                UInt32 to_precision = 0;
144
506
                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
506
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
506
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
506
                    to_precision = to_max_digits;
160
506
                }
161
162
506
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
506
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
506
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
506
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
506
                return narrow_integral || multiply_may_overflow;
171
506
            }
172
0
            return false;
173
506
        });
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
328
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
328
            using Types2 = std::decay_t<decltype(types2)>;
122
328
            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
328
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
328
                using FromFieldType = typename FromDataType::FieldType;
130
328
                using ToFieldType = typename ToDataType::FieldType;
131
328
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
328
                UInt32 from_scale = 0;
133
134
328
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
328
                    const auto* from_decimal_type =
136
328
                            check_and_get_data_type<FromDataType>(from_type.get());
137
328
                    from_precision =
138
328
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
328
                    from_scale = from_decimal_type->get_scale();
140
328
                }
141
142
328
                UInt32 to_max_digits = 0;
143
328
                UInt32 to_precision = 0;
144
328
                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
328
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
328
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
328
                    to_precision = to_max_digits;
160
328
                }
161
162
328
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
328
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
328
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
328
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
328
                return narrow_integral || multiply_may_overflow;
171
328
            }
172
0
            return false;
173
328
        });
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
690
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
690
            using Types2 = std::decay_t<decltype(types2)>;
122
690
            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
690
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
690
                using FromFieldType = typename FromDataType::FieldType;
130
690
                using ToFieldType = typename ToDataType::FieldType;
131
690
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
690
                UInt32 from_scale = 0;
133
134
690
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
690
                    const auto* from_decimal_type =
136
690
                            check_and_get_data_type<FromDataType>(from_type.get());
137
690
                    from_precision =
138
690
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
690
                    from_scale = from_decimal_type->get_scale();
140
690
                }
141
142
690
                UInt32 to_max_digits = 0;
143
690
                UInt32 to_precision = 0;
144
690
                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
690
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
690
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
690
                    to_precision = to_max_digits;
160
690
                }
161
162
690
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
690
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
690
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
690
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
690
                return narrow_integral || multiply_may_overflow;
171
690
            }
172
0
            return false;
173
690
        });
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
544
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
544
            using Types2 = std::decay_t<decltype(types2)>;
122
544
            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
544
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
544
                using FromFieldType = typename FromDataType::FieldType;
130
544
                using ToFieldType = typename ToDataType::FieldType;
131
544
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
544
                UInt32 from_scale = 0;
133
134
544
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
544
                    const auto* from_decimal_type =
136
544
                            check_and_get_data_type<FromDataType>(from_type.get());
137
544
                    from_precision =
138
544
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
544
                    from_scale = from_decimal_type->get_scale();
140
544
                }
141
142
544
                UInt32 to_max_digits = 0;
143
544
                UInt32 to_precision = 0;
144
544
                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
544
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
544
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
544
                    to_precision = to_max_digits;
160
544
                }
161
162
544
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
544
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
544
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
544
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
544
                return narrow_integral || multiply_may_overflow;
171
544
            }
172
0
            return false;
173
544
        });
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
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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
120
7.84k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7.84k
            using Types2 = std::decay_t<decltype(types2)>;
122
7.84k
            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.84k
            return false;
173
7.84k
        });
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
6.24k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
6.24k
            using Types2 = std::decay_t<decltype(types2)>;
122
6.24k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
6.24k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
6.24k
                return false;
127
6.24k
            }
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.24k
            return false;
173
6.24k
        });
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
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
279
                    multiply_may_overflow &=
168
279
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
279
                }
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_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
120
501
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
501
            using Types2 = std::decay_t<decltype(types2)>;
122
501
            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
501
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
501
                using FromFieldType = typename FromDataType::FieldType;
130
501
                using ToFieldType = typename ToDataType::FieldType;
131
501
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
501
                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
501
                UInt32 to_max_digits = 0;
143
501
                UInt32 to_precision = 0;
144
501
                UInt32 to_scale = 0;
145
146
501
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
501
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
501
                    const auto* to_decimal_type =
150
501
                            check_and_get_data_type<ToDataType>(to_type.get());
151
501
                    to_precision = to_decimal_type->get_precision();
152
501
                    ToDataType::check_type_precision(to_precision);
153
154
501
                    to_scale = to_decimal_type->get_scale();
155
501
                    ToDataType::check_type_scale(to_scale);
156
501
                }
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
501
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
501
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
501
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
501
                if (to_scale > from_scale) {
167
252
                    multiply_may_overflow &=
168
252
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
252
                }
170
501
                return narrow_integral || multiply_may_overflow;
171
501
            }
172
0
            return false;
173
501
        });
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
552
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
552
            using Types2 = std::decay_t<decltype(types2)>;
122
552
            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
552
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
552
                using FromFieldType = typename FromDataType::FieldType;
130
552
                using ToFieldType = typename ToDataType::FieldType;
131
552
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
552
                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
552
                UInt32 to_max_digits = 0;
143
552
                UInt32 to_precision = 0;
144
552
                UInt32 to_scale = 0;
145
146
552
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
552
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
552
                    const auto* to_decimal_type =
150
552
                            check_and_get_data_type<ToDataType>(to_type.get());
151
552
                    to_precision = to_decimal_type->get_precision();
152
552
                    ToDataType::check_type_precision(to_precision);
153
154
552
                    to_scale = to_decimal_type->get_scale();
155
552
                    ToDataType::check_type_scale(to_scale);
156
552
                }
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
552
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
552
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
552
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
552
                if (to_scale > from_scale) {
167
280
                    multiply_may_overflow &=
168
280
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
280
                }
170
552
                return narrow_integral || multiply_may_overflow;
171
552
            }
172
0
            return false;
173
552
        });
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
400
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
400
            using Types2 = std::decay_t<decltype(types2)>;
122
400
            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
400
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
400
                using FromFieldType = typename FromDataType::FieldType;
130
400
                using ToFieldType = typename ToDataType::FieldType;
131
400
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
400
                UInt32 from_scale = 0;
133
134
400
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
400
                    const auto* from_decimal_type =
136
400
                            check_and_get_data_type<FromDataType>(from_type.get());
137
400
                    from_precision =
138
400
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
400
                    from_scale = from_decimal_type->get_scale();
140
400
                }
141
142
400
                UInt32 to_max_digits = 0;
143
400
                UInt32 to_precision = 0;
144
400
                UInt32 to_scale = 0;
145
146
400
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
400
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
400
                    const auto* to_decimal_type =
150
400
                            check_and_get_data_type<ToDataType>(to_type.get());
151
400
                    to_precision = to_decimal_type->get_precision();
152
400
                    ToDataType::check_type_precision(to_precision);
153
154
400
                    to_scale = to_decimal_type->get_scale();
155
400
                    ToDataType::check_type_scale(to_scale);
156
400
                }
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
400
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
400
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
400
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
400
                if (to_scale > from_scale) {
167
81
                    multiply_may_overflow &=
168
81
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
81
                }
170
400
                return narrow_integral || multiply_may_overflow;
171
400
            }
172
0
            return false;
173
400
        });
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
237
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
237
            using Types2 = std::decay_t<decltype(types2)>;
122
237
            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
237
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
237
                using FromFieldType = typename FromDataType::FieldType;
130
237
                using ToFieldType = typename ToDataType::FieldType;
131
237
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
237
                UInt32 from_scale = 0;
133
134
237
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
237
                    const auto* from_decimal_type =
136
237
                            check_and_get_data_type<FromDataType>(from_type.get());
137
237
                    from_precision =
138
237
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
237
                    from_scale = from_decimal_type->get_scale();
140
237
                }
141
142
237
                UInt32 to_max_digits = 0;
143
237
                UInt32 to_precision = 0;
144
237
                UInt32 to_scale = 0;
145
146
237
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
237
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
237
                    const auto* to_decimal_type =
150
237
                            check_and_get_data_type<ToDataType>(to_type.get());
151
237
                    to_precision = to_decimal_type->get_precision();
152
237
                    ToDataType::check_type_precision(to_precision);
153
154
237
                    to_scale = to_decimal_type->get_scale();
155
237
                    ToDataType::check_type_scale(to_scale);
156
237
                }
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
237
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
237
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
237
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
237
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
237
                return narrow_integral || multiply_may_overflow;
171
237
            }
172
0
            return false;
173
237
        });
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
429
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
429
            using Types2 = std::decay_t<decltype(types2)>;
122
429
            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
429
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
429
                using FromFieldType = typename FromDataType::FieldType;
130
429
                using ToFieldType = typename ToDataType::FieldType;
131
429
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
429
                UInt32 from_scale = 0;
133
134
429
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
429
                    const auto* from_decimal_type =
136
429
                            check_and_get_data_type<FromDataType>(from_type.get());
137
429
                    from_precision =
138
429
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
429
                    from_scale = from_decimal_type->get_scale();
140
429
                }
141
142
429
                UInt32 to_max_digits = 0;
143
429
                UInt32 to_precision = 0;
144
429
                UInt32 to_scale = 0;
145
146
429
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
429
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
429
                    const auto* to_decimal_type =
150
429
                            check_and_get_data_type<ToDataType>(to_type.get());
151
429
                    to_precision = to_decimal_type->get_precision();
152
429
                    ToDataType::check_type_precision(to_precision);
153
154
429
                    to_scale = to_decimal_type->get_scale();
155
429
                    ToDataType::check_type_scale(to_scale);
156
429
                }
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
429
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
429
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
429
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
429
                if (to_scale > from_scale) {
167
139
                    multiply_may_overflow &=
168
139
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
139
                }
170
429
                return narrow_integral || multiply_may_overflow;
171
429
            }
172
0
            return false;
173
429
        });
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.80k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2.80k
            using Types2 = std::decay_t<decltype(types2)>;
122
2.80k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
2.80k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
2.80k
                return false;
127
2.80k
            }
128
2.80k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
2.80k
                using FromFieldType = typename FromDataType::FieldType;
130
2.80k
                using ToFieldType = typename ToDataType::FieldType;
131
2.80k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
2.80k
                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.80k
                UInt32 to_max_digits = 0;
143
2.80k
                UInt32 to_precision = 0;
144
2.80k
                UInt32 to_scale = 0;
145
146
2.80k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
2.80k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
2.80k
                    const auto* to_decimal_type =
150
2.80k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
2.80k
                    to_precision = to_decimal_type->get_precision();
152
2.80k
                    ToDataType::check_type_precision(to_precision);
153
154
2.80k
                    to_scale = to_decimal_type->get_scale();
155
2.80k
                    ToDataType::check_type_scale(to_scale);
156
2.80k
                }
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.80k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
2.80k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
2.80k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
2.80k
                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.80k
                return narrow_integral || multiply_may_overflow;
171
2.80k
            }
172
0
            return false;
173
2.80k
        });
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
468
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
468
            using Types2 = std::decay_t<decltype(types2)>;
122
468
            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
468
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
468
                using FromFieldType = typename FromDataType::FieldType;
130
468
                using ToFieldType = typename ToDataType::FieldType;
131
468
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
468
                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
468
                UInt32 to_max_digits = 0;
143
468
                UInt32 to_precision = 0;
144
468
                UInt32 to_scale = 0;
145
146
468
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
468
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
468
                    const auto* to_decimal_type =
150
468
                            check_and_get_data_type<ToDataType>(to_type.get());
151
468
                    to_precision = to_decimal_type->get_precision();
152
468
                    ToDataType::check_type_precision(to_precision);
153
154
468
                    to_scale = to_decimal_type->get_scale();
155
468
                    ToDataType::check_type_scale(to_scale);
156
468
                }
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
468
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
468
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
468
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
468
                if (to_scale > from_scale) {
167
314
                    multiply_may_overflow &=
168
314
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
314
                }
170
468
                return narrow_integral || multiply_may_overflow;
171
468
            }
172
0
            return false;
173
468
        });
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
52
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
52
            using Types2 = std::decay_t<decltype(types2)>;
122
52
            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
52
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
52
                using FromFieldType = typename FromDataType::FieldType;
130
52
                using ToFieldType = typename ToDataType::FieldType;
131
52
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
52
                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
52
                UInt32 to_max_digits = 0;
143
52
                UInt32 to_precision = 0;
144
52
                UInt32 to_scale = 0;
145
146
52
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
52
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
52
                    const auto* to_decimal_type =
150
52
                            check_and_get_data_type<ToDataType>(to_type.get());
151
52
                    to_precision = to_decimal_type->get_precision();
152
52
                    ToDataType::check_type_precision(to_precision);
153
154
52
                    to_scale = to_decimal_type->get_scale();
155
52
                    ToDataType::check_type_scale(to_scale);
156
52
                }
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
52
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
52
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
52
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
52
                if (to_scale > from_scale) {
167
31
                    multiply_may_overflow &=
168
31
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
31
                }
170
52
                return narrow_integral || multiply_may_overflow;
171
52
            }
172
0
            return false;
173
52
        });
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.10k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.10k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.10k
            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.10k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.10k
                using FromFieldType = typename FromDataType::FieldType;
130
1.10k
                using ToFieldType = typename ToDataType::FieldType;
131
1.10k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.10k
                UInt32 from_scale = 0;
133
134
1.10k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
1.10k
                    const auto* from_decimal_type =
136
1.10k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
1.10k
                    from_precision =
138
1.10k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
1.10k
                    from_scale = from_decimal_type->get_scale();
140
1.10k
                }
141
142
1.10k
                UInt32 to_max_digits = 0;
143
1.10k
                UInt32 to_precision = 0;
144
1.10k
                UInt32 to_scale = 0;
145
146
1.10k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.10k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.10k
                    const auto* to_decimal_type =
150
1.10k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.10k
                    to_precision = to_decimal_type->get_precision();
152
1.10k
                    ToDataType::check_type_precision(to_precision);
153
154
1.10k
                    to_scale = to_decimal_type->get_scale();
155
1.10k
                    ToDataType::check_type_scale(to_scale);
156
1.10k
                }
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.10k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.10k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.10k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.10k
                if (to_scale > from_scale) {
167
767
                    multiply_may_overflow &=
168
767
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
767
                }
170
1.10k
                return narrow_integral || multiply_may_overflow;
171
1.10k
            }
172
0
            return false;
173
1.10k
        });
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
4.11k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
4.11k
            using Types2 = std::decay_t<decltype(types2)>;
122
4.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
4.11k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
4.11k
                using FromFieldType = typename FromDataType::FieldType;
130
4.11k
                using ToFieldType = typename ToDataType::FieldType;
131
4.11k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
4.11k
                UInt32 from_scale = 0;
133
134
4.11k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
4.11k
                    const auto* from_decimal_type =
136
4.11k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
4.11k
                    from_precision =
138
4.11k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
4.11k
                    from_scale = from_decimal_type->get_scale();
140
4.11k
                }
141
142
4.11k
                UInt32 to_max_digits = 0;
143
4.11k
                UInt32 to_precision = 0;
144
4.11k
                UInt32 to_scale = 0;
145
146
4.11k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
4.11k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
4.11k
                    const auto* to_decimal_type =
150
4.11k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
4.11k
                    to_precision = to_decimal_type->get_precision();
152
4.11k
                    ToDataType::check_type_precision(to_precision);
153
154
4.11k
                    to_scale = to_decimal_type->get_scale();
155
4.11k
                    ToDataType::check_type_scale(to_scale);
156
4.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
4.11k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
4.11k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
4.11k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
4.11k
                if (to_scale > from_scale) {
167
157
                    multiply_may_overflow &=
168
157
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
157
                }
170
4.11k
                return narrow_integral || multiply_may_overflow;
171
4.11k
            }
172
0
            return false;
173
4.11k
        });
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
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
320
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
320
                using FromFieldType = typename FromDataType::FieldType;
130
320
                using ToFieldType = typename ToDataType::FieldType;
131
320
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
320
                UInt32 from_scale = 0;
133
134
320
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
320
                    const auto* from_decimal_type =
136
320
                            check_and_get_data_type<FromDataType>(from_type.get());
137
320
                    from_precision =
138
320
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
320
                    from_scale = from_decimal_type->get_scale();
140
320
                }
141
142
320
                UInt32 to_max_digits = 0;
143
320
                UInt32 to_precision = 0;
144
320
                UInt32 to_scale = 0;
145
146
320
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
320
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
320
                    const auto* to_decimal_type =
150
320
                            check_and_get_data_type<ToDataType>(to_type.get());
151
320
                    to_precision = to_decimal_type->get_precision();
152
320
                    ToDataType::check_type_precision(to_precision);
153
154
320
                    to_scale = to_decimal_type->get_scale();
155
320
                    ToDataType::check_type_scale(to_scale);
156
320
                }
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
320
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
320
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
320
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
320
                if (to_scale > from_scale) {
167
50
                    multiply_may_overflow &=
168
50
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
50
                }
170
320
                return narrow_integral || multiply_may_overflow;
171
320
            }
172
0
            return false;
173
320
        });
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
425
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
425
            using Types2 = std::decay_t<decltype(types2)>;
122
425
            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
425
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
425
                using FromFieldType = typename FromDataType::FieldType;
130
425
                using ToFieldType = typename ToDataType::FieldType;
131
425
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
425
                UInt32 from_scale = 0;
133
134
425
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
425
                    const auto* from_decimal_type =
136
425
                            check_and_get_data_type<FromDataType>(from_type.get());
137
425
                    from_precision =
138
425
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
425
                    from_scale = from_decimal_type->get_scale();
140
425
                }
141
142
425
                UInt32 to_max_digits = 0;
143
425
                UInt32 to_precision = 0;
144
425
                UInt32 to_scale = 0;
145
146
425
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
425
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
425
                    const auto* to_decimal_type =
150
425
                            check_and_get_data_type<ToDataType>(to_type.get());
151
425
                    to_precision = to_decimal_type->get_precision();
152
425
                    ToDataType::check_type_precision(to_precision);
153
154
425
                    to_scale = to_decimal_type->get_scale();
155
425
                    ToDataType::check_type_scale(to_scale);
156
425
                }
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
425
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
425
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
425
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
425
                if (to_scale > from_scale) {
167
144
                    multiply_may_overflow &=
168
144
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
144
                }
170
425
                return narrow_integral || multiply_may_overflow;
171
425
            }
172
0
            return false;
173
425
        });
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.87k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7.87k
            using Types2 = std::decay_t<decltype(types2)>;
122
7.87k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
7.87k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
7.87k
                return false;
127
7.87k
            }
128
7.87k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
7.87k
                using FromFieldType = typename FromDataType::FieldType;
130
7.87k
                using ToFieldType = typename ToDataType::FieldType;
131
7.87k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
7.87k
                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.87k
                UInt32 to_max_digits = 0;
143
7.87k
                UInt32 to_precision = 0;
144
7.87k
                UInt32 to_scale = 0;
145
146
7.87k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
7.87k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
7.87k
                    const auto* to_decimal_type =
150
7.87k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
7.87k
                    to_precision = to_decimal_type->get_precision();
152
7.87k
                    ToDataType::check_type_precision(to_precision);
153
154
7.87k
                    to_scale = to_decimal_type->get_scale();
155
7.87k
                    ToDataType::check_type_scale(to_scale);
156
7.87k
                }
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.87k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
7.87k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
7.87k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
7.87k
                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.87k
                return narrow_integral || multiply_may_overflow;
171
7.87k
            }
172
0
            return false;
173
7.87k
        });
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
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
                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
20
                UInt32 to_max_digits = 0;
143
20
                UInt32 to_precision = 0;
144
20
                UInt32 to_scale = 0;
145
146
20
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
20
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
20
                    const auto* to_decimal_type =
150
20
                            check_and_get_data_type<ToDataType>(to_type.get());
151
20
                    to_precision = to_decimal_type->get_precision();
152
20
                    ToDataType::check_type_precision(to_precision);
153
154
20
                    to_scale = to_decimal_type->get_scale();
155
20
                    ToDataType::check_type_scale(to_scale);
156
20
                }
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
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
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
20
            }
172
0
            return false;
173
20
        });
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
15
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
15
            using Types2 = std::decay_t<decltype(types2)>;
122
15
            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
15
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
15
                using FromFieldType = typename FromDataType::FieldType;
130
15
                using ToFieldType = typename ToDataType::FieldType;
131
15
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
15
                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
15
                UInt32 to_max_digits = 0;
143
15
                UInt32 to_precision = 0;
144
15
                UInt32 to_scale = 0;
145
146
15
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
15
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
15
                    const auto* to_decimal_type =
150
15
                            check_and_get_data_type<ToDataType>(to_type.get());
151
15
                    to_precision = to_decimal_type->get_precision();
152
15
                    ToDataType::check_type_precision(to_precision);
153
154
15
                    to_scale = to_decimal_type->get_scale();
155
15
                    ToDataType::check_type_scale(to_scale);
156
15
                }
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
15
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
15
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
15
                if (to_scale > from_scale) {
167
15
                    multiply_may_overflow &=
168
15
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
15
                }
170
16
                return narrow_integral || multiply_may_overflow;
171
15
            }
172
0
            return false;
173
15
        });
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
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
31
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
31
                using FromFieldType = typename FromDataType::FieldType;
130
31
                using ToFieldType = typename ToDataType::FieldType;
131
31
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
31
                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
31
                UInt32 to_max_digits = 0;
143
31
                UInt32 to_precision = 0;
144
31
                UInt32 to_scale = 0;
145
146
31
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
31
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
31
                    const auto* to_decimal_type =
150
31
                            check_and_get_data_type<ToDataType>(to_type.get());
151
31
                    to_precision = to_decimal_type->get_precision();
152
31
                    ToDataType::check_type_precision(to_precision);
153
154
31
                    to_scale = to_decimal_type->get_scale();
155
31
                    ToDataType::check_type_scale(to_scale);
156
31
                }
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
31
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
31
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
31
                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
31
                return narrow_integral || multiply_may_overflow;
171
31
            }
172
0
            return false;
173
31
        });
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
125
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
125
            using Types2 = std::decay_t<decltype(types2)>;
122
125
            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
125
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
125
                using FromFieldType = typename FromDataType::FieldType;
130
125
                using ToFieldType = typename ToDataType::FieldType;
131
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
125
                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
125
                UInt32 to_max_digits = 0;
143
125
                UInt32 to_precision = 0;
144
125
                UInt32 to_scale = 0;
145
146
125
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
125
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
125
                    const auto* to_decimal_type =
150
125
                            check_and_get_data_type<ToDataType>(to_type.get());
151
125
                    to_precision = to_decimal_type->get_precision();
152
125
                    ToDataType::check_type_precision(to_precision);
153
154
125
                    to_scale = to_decimal_type->get_scale();
155
125
                    ToDataType::check_type_scale(to_scale);
156
125
                }
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
125
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
127
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
125
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
127
                if (to_scale > from_scale) {
167
127
                    multiply_may_overflow &=
168
127
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
127
                }
170
125
                return narrow_integral || multiply_may_overflow;
171
125
            }
172
0
            return false;
173
125
        });
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
443
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
443
            using Types2 = std::decay_t<decltype(types2)>;
122
443
            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
443
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
443
                using FromFieldType = typename FromDataType::FieldType;
130
443
                using ToFieldType = typename ToDataType::FieldType;
131
443
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
443
                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
443
                UInt32 to_max_digits = 0;
143
443
                UInt32 to_precision = 0;
144
443
                UInt32 to_scale = 0;
145
146
443
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
443
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
443
                    const auto* to_decimal_type =
150
443
                            check_and_get_data_type<ToDataType>(to_type.get());
151
443
                    to_precision = to_decimal_type->get_precision();
152
443
                    ToDataType::check_type_precision(to_precision);
153
154
443
                    to_scale = to_decimal_type->get_scale();
155
443
                    ToDataType::check_type_scale(to_scale);
156
443
                }
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
443
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
443
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
443
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
443
                if (to_scale > from_scale) {
167
387
                    multiply_may_overflow &=
168
387
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
387
                }
170
443
                return narrow_integral || multiply_may_overflow;
171
443
            }
172
0
            return false;
173
443
        });
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.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2.41k
            using Types2 = std::decay_t<decltype(types2)>;
122
2.41k
            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.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
2.41k
                using FromFieldType = typename FromDataType::FieldType;
130
2.41k
                using ToFieldType = typename ToDataType::FieldType;
131
2.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
2.41k
                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.41k
                UInt32 to_max_digits = 0;
143
2.41k
                UInt32 to_precision = 0;
144
2.41k
                UInt32 to_scale = 0;
145
146
2.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
2.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
2.41k
                    const auto* to_decimal_type =
150
2.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
2.41k
                    to_precision = to_decimal_type->get_precision();
152
2.41k
                    ToDataType::check_type_precision(to_precision);
153
154
2.41k
                    to_scale = to_decimal_type->get_scale();
155
2.41k
                    ToDataType::check_type_scale(to_scale);
156
2.41k
                }
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.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
2.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
2.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
2.41k
                if (to_scale > from_scale) {
167
522
                    multiply_may_overflow &=
168
522
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
522
                }
170
2.41k
                return narrow_integral || multiply_may_overflow;
171
2.41k
            }
172
0
            return false;
173
2.41k
        });
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
366
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
366
            using Types2 = std::decay_t<decltype(types2)>;
122
366
            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
366
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
366
                using FromFieldType = typename FromDataType::FieldType;
130
366
                using ToFieldType = typename ToDataType::FieldType;
131
366
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
366
                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
366
                UInt32 to_max_digits = 0;
143
366
                UInt32 to_precision = 0;
144
366
                UInt32 to_scale = 0;
145
146
366
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
366
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
366
                    const auto* to_decimal_type =
150
366
                            check_and_get_data_type<ToDataType>(to_type.get());
151
366
                    to_precision = to_decimal_type->get_precision();
152
366
                    ToDataType::check_type_precision(to_precision);
153
154
366
                    to_scale = to_decimal_type->get_scale();
155
366
                    ToDataType::check_type_scale(to_scale);
156
366
                }
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
366
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
366
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
366
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
366
                if (to_scale > from_scale) {
167
196
                    multiply_may_overflow &=
168
196
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
196
                }
170
366
                return narrow_integral || multiply_may_overflow;
171
366
            }
172
0
            return false;
173
366
        });
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
742
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
742
            using Types2 = std::decay_t<decltype(types2)>;
122
742
            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
742
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
742
                using FromFieldType = typename FromDataType::FieldType;
130
742
                using ToFieldType = typename ToDataType::FieldType;
131
742
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
742
                UInt32 from_scale = 0;
133
134
742
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
742
                    const auto* from_decimal_type =
136
742
                            check_and_get_data_type<FromDataType>(from_type.get());
137
742
                    from_precision =
138
742
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
742
                    from_scale = from_decimal_type->get_scale();
140
742
                }
141
142
742
                UInt32 to_max_digits = 0;
143
742
                UInt32 to_precision = 0;
144
742
                UInt32 to_scale = 0;
145
146
742
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
742
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
742
                    const auto* to_decimal_type =
150
742
                            check_and_get_data_type<ToDataType>(to_type.get());
151
742
                    to_precision = to_decimal_type->get_precision();
152
742
                    ToDataType::check_type_precision(to_precision);
153
154
742
                    to_scale = to_decimal_type->get_scale();
155
742
                    ToDataType::check_type_scale(to_scale);
156
742
                }
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
742
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
742
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
742
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
742
                if (to_scale > from_scale) {
167
602
                    multiply_may_overflow &=
168
602
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
602
                }
170
742
                return narrow_integral || multiply_may_overflow;
171
742
            }
172
0
            return false;
173
742
        });
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.04k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.04k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.04k
            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.04k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.04k
                using FromFieldType = typename FromDataType::FieldType;
130
1.04k
                using ToFieldType = typename ToDataType::FieldType;
131
1.04k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.04k
                UInt32 from_scale = 0;
133
134
1.04k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
1.04k
                    const auto* from_decimal_type =
136
1.04k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
1.04k
                    from_precision =
138
1.04k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
1.04k
                    from_scale = from_decimal_type->get_scale();
140
1.04k
                }
141
142
1.04k
                UInt32 to_max_digits = 0;
143
1.04k
                UInt32 to_precision = 0;
144
1.04k
                UInt32 to_scale = 0;
145
146
1.04k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.04k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.04k
                    const auto* to_decimal_type =
150
1.04k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.04k
                    to_precision = to_decimal_type->get_precision();
152
1.04k
                    ToDataType::check_type_precision(to_precision);
153
154
1.04k
                    to_scale = to_decimal_type->get_scale();
155
1.04k
                    ToDataType::check_type_scale(to_scale);
156
1.04k
                }
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.04k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.04k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.04k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.04k
                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.04k
                return narrow_integral || multiply_may_overflow;
171
1.04k
            }
172
0
            return false;
173
1.04k
        });
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
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
333
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
333
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
333
                    const auto* to_decimal_type =
150
333
                            check_and_get_data_type<ToDataType>(to_type.get());
151
333
                    to_precision = to_decimal_type->get_precision();
152
333
                    ToDataType::check_type_precision(to_precision);
153
154
333
                    to_scale = to_decimal_type->get_scale();
155
333
                    ToDataType::check_type_scale(to_scale);
156
333
                }
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
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
71
                    multiply_may_overflow &=
168
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
71
                }
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_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
120
2.17k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2.17k
            using Types2 = std::decay_t<decltype(types2)>;
122
2.17k
            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.17k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
2.17k
                using FromFieldType = typename FromDataType::FieldType;
130
2.17k
                using ToFieldType = typename ToDataType::FieldType;
131
2.17k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
2.17k
                UInt32 from_scale = 0;
133
134
2.17k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
2.17k
                    const auto* from_decimal_type =
136
2.17k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
2.17k
                    from_precision =
138
2.17k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
2.17k
                    from_scale = from_decimal_type->get_scale();
140
2.17k
                }
141
142
2.17k
                UInt32 to_max_digits = 0;
143
2.17k
                UInt32 to_precision = 0;
144
2.17k
                UInt32 to_scale = 0;
145
146
2.17k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
2.17k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
2.17k
                    const auto* to_decimal_type =
150
2.17k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
2.17k
                    to_precision = to_decimal_type->get_precision();
152
2.17k
                    ToDataType::check_type_precision(to_precision);
153
154
2.17k
                    to_scale = to_decimal_type->get_scale();
155
2.17k
                    ToDataType::check_type_scale(to_scale);
156
2.17k
                }
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.17k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
2.17k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
2.17k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
2.17k
                if (to_scale > from_scale) {
167
707
                    multiply_may_overflow &=
168
707
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
707
                }
170
2.17k
                return narrow_integral || multiply_may_overflow;
171
2.17k
            }
172
0
            return false;
173
2.17k
        });
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.18k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
5.18k
            using Types2 = std::decay_t<decltype(types2)>;
122
5.18k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
5.18k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
5.18k
                return false;
127
5.18k
            }
128
5.18k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
5.18k
                using FromFieldType = typename FromDataType::FieldType;
130
5.18k
                using ToFieldType = typename ToDataType::FieldType;
131
5.18k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
5.18k
                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.18k
                UInt32 to_max_digits = 0;
143
5.18k
                UInt32 to_precision = 0;
144
5.18k
                UInt32 to_scale = 0;
145
146
5.18k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
5.18k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
5.18k
                    const auto* to_decimal_type =
150
5.18k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
5.18k
                    to_precision = to_decimal_type->get_precision();
152
5.18k
                    ToDataType::check_type_precision(to_precision);
153
154
5.18k
                    to_scale = to_decimal_type->get_scale();
155
5.18k
                    ToDataType::check_type_scale(to_scale);
156
5.18k
                }
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.18k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
5.18k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
5.18k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
5.18k
                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.18k
                return narrow_integral || multiply_may_overflow;
171
5.18k
            }
172
0
            return false;
173
5.18k
        });
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.22k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.22k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.22k
            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.22k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.22k
                using FromFieldType = typename FromDataType::FieldType;
130
1.22k
                using ToFieldType = typename ToDataType::FieldType;
131
1.22k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.22k
                UInt32 from_scale = 0;
133
134
1.22k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
1.22k
                    const auto* from_decimal_type =
136
1.22k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
1.22k
                    from_precision =
138
1.22k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
1.22k
                    from_scale = from_decimal_type->get_scale();
140
1.22k
                }
141
142
1.22k
                UInt32 to_max_digits = 0;
143
1.22k
                UInt32 to_precision = 0;
144
1.22k
                UInt32 to_scale = 0;
145
146
1.22k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.22k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.22k
                    const auto* to_decimal_type =
150
1.22k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.22k
                    to_precision = to_decimal_type->get_precision();
152
1.22k
                    ToDataType::check_type_precision(to_precision);
153
154
1.22k
                    to_scale = to_decimal_type->get_scale();
155
1.22k
                    ToDataType::check_type_scale(to_scale);
156
1.22k
                }
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.22k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.22k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.22k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.22k
                if (to_scale > from_scale) {
167
740
                    multiply_may_overflow &=
168
740
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
740
                }
170
1.22k
                return narrow_integral || multiply_may_overflow;
171
1.22k
            }
172
0
            return false;
173
1.22k
        });
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
930
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
930
            using Types2 = std::decay_t<decltype(types2)>;
122
930
            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
930
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
930
                using FromFieldType = typename FromDataType::FieldType;
130
930
                using ToFieldType = typename ToDataType::FieldType;
131
930
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
930
                UInt32 from_scale = 0;
133
134
930
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
930
                    const auto* from_decimal_type =
136
930
                            check_and_get_data_type<FromDataType>(from_type.get());
137
930
                    from_precision =
138
930
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
930
                    from_scale = from_decimal_type->get_scale();
140
930
                }
141
142
930
                UInt32 to_max_digits = 0;
143
930
                UInt32 to_precision = 0;
144
930
                UInt32 to_scale = 0;
145
146
930
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
930
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
930
                    const auto* to_decimal_type =
150
930
                            check_and_get_data_type<ToDataType>(to_type.get());
151
930
                    to_precision = to_decimal_type->get_precision();
152
930
                    ToDataType::check_type_precision(to_precision);
153
154
930
                    to_scale = to_decimal_type->get_scale();
155
930
                    ToDataType::check_type_scale(to_scale);
156
930
                }
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
930
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
930
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
930
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
930
                if (to_scale > from_scale) {
167
453
                    multiply_may_overflow &=
168
453
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
453
                }
170
930
                return narrow_integral || multiply_may_overflow;
171
930
            }
172
0
            return false;
173
930
        });
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
383
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
383
            using Types2 = std::decay_t<decltype(types2)>;
122
383
            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
383
            return false;
173
383
        });
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
220
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
220
            using Types2 = std::decay_t<decltype(types2)>;
122
220
            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
220
            return false;
173
220
        });
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
6.12k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
6.12k
            using Types2 = std::decay_t<decltype(types2)>;
122
6.12k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
6.12k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
6.12k
                return false;
127
6.12k
            }
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.12k
            return false;
173
6.12k
        });
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
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
12
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
12
                using FromFieldType = typename FromDataType::FieldType;
130
12
                using ToFieldType = typename ToDataType::FieldType;
131
12
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
12
                UInt32 from_scale = 0;
133
134
12
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
12
                    const auto* from_decimal_type =
136
12
                            check_and_get_data_type<FromDataType>(from_type.get());
137
12
                    from_precision =
138
12
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
12
                    from_scale = from_decimal_type->get_scale();
140
12
                }
141
142
12
                UInt32 to_max_digits = 0;
143
12
                UInt32 to_precision = 0;
144
12
                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
12
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
12
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
12
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
12
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
12
                return narrow_integral || multiply_may_overflow;
171
12
            }
172
0
            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_13PrimitiveTypeE29EEESC_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
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
4
                using FromFieldType = typename FromDataType::FieldType;
130
4
                using ToFieldType = typename ToDataType::FieldType;
131
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
4
                UInt32 from_scale = 0;
133
134
4
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
4
                    const auto* from_decimal_type =
136
4
                            check_and_get_data_type<FromDataType>(from_type.get());
137
4
                    from_precision =
138
4
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
4
                    from_scale = from_decimal_type->get_scale();
140
4
                }
141
142
4
                UInt32 to_max_digits = 0;
143
4
                UInt32 to_precision = 0;
144
4
                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
4
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
4
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
4
                return narrow_integral || multiply_may_overflow;
171
4
            }
172
0
            return false;
173
4
        });
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
384
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
384
            using Types2 = std::decay_t<decltype(types2)>;
122
384
            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
384
            return false;
173
384
        });
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
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_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
120
356
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
356
            using Types2 = std::decay_t<decltype(types2)>;
122
356
            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
356
            return false;
173
356
        });
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.87k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
3.87k
            using Types2 = std::decay_t<decltype(types2)>;
122
3.87k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
3.87k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
3.87k
                return false;
127
3.87k
            }
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.87k
            return false;
173
3.87k
        });
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
298
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
298
            using Types2 = std::decay_t<decltype(types2)>;
122
298
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
298
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
298
                return false;
127
298
            }
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
298
            return false;
173
298
        });
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
228k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
110
2.42k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
2.42k
        using Types = std::decay_t<decltype(types)>;
112
2.42k
        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.42k
        return call_on_index_and_data_type<
120
2.42k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2.42k
            using Types2 = std::decay_t<decltype(types2)>;
122
2.42k
            using FromDataType = typename Types2::LeftType;
123
2.42k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
2.42k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
2.42k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
2.42k
                return false;
127
2.42k
            }
128
2.42k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
2.42k
                using FromFieldType = typename FromDataType::FieldType;
130
2.42k
                using ToFieldType = typename ToDataType::FieldType;
131
2.42k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
2.42k
                UInt32 from_scale = 0;
133
134
2.42k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
2.42k
                    const auto* from_decimal_type =
136
2.42k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
2.42k
                    from_precision =
138
2.42k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
2.42k
                    from_scale = from_decimal_type->get_scale();
140
2.42k
                }
141
142
2.42k
                UInt32 to_max_digits = 0;
143
2.42k
                UInt32 to_precision = 0;
144
2.42k
                UInt32 to_scale = 0;
145
146
2.42k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
2.42k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
2.42k
                    const auto* to_decimal_type =
150
2.42k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
2.42k
                    to_precision = to_decimal_type->get_precision();
152
2.42k
                    ToDataType::check_type_precision(to_precision);
153
154
2.42k
                    to_scale = to_decimal_type->get_scale();
155
2.42k
                    ToDataType::check_type_scale(to_scale);
156
2.42k
                }
157
2.42k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
2.42k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
2.42k
                    to_precision = to_max_digits;
160
2.42k
                }
161
162
2.42k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
2.42k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
2.42k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
2.42k
                if (to_scale > from_scale) {
167
2.42k
                    multiply_may_overflow &=
168
2.42k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
2.42k
                }
170
2.42k
                return narrow_integral || multiply_may_overflow;
171
2.42k
            }
172
2.42k
            return false;
173
2.42k
        });
174
2.42k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
110
4.87k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
4.87k
        using Types = std::decay_t<decltype(types)>;
112
4.87k
        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.87k
        return call_on_index_and_data_type<
120
4.87k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
4.87k
            using Types2 = std::decay_t<decltype(types2)>;
122
4.87k
            using FromDataType = typename Types2::LeftType;
123
4.87k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
4.87k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
4.87k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
4.87k
                return false;
127
4.87k
            }
128
4.87k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
4.87k
                using FromFieldType = typename FromDataType::FieldType;
130
4.87k
                using ToFieldType = typename ToDataType::FieldType;
131
4.87k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
4.87k
                UInt32 from_scale = 0;
133
134
4.87k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
4.87k
                    const auto* from_decimal_type =
136
4.87k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
4.87k
                    from_precision =
138
4.87k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
4.87k
                    from_scale = from_decimal_type->get_scale();
140
4.87k
                }
141
142
4.87k
                UInt32 to_max_digits = 0;
143
4.87k
                UInt32 to_precision = 0;
144
4.87k
                UInt32 to_scale = 0;
145
146
4.87k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
4.87k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
4.87k
                    const auto* to_decimal_type =
150
4.87k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
4.87k
                    to_precision = to_decimal_type->get_precision();
152
4.87k
                    ToDataType::check_type_precision(to_precision);
153
154
4.87k
                    to_scale = to_decimal_type->get_scale();
155
4.87k
                    ToDataType::check_type_scale(to_scale);
156
4.87k
                }
157
4.87k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
4.87k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
4.87k
                    to_precision = to_max_digits;
160
4.87k
                }
161
162
4.87k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
4.87k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
4.87k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
4.87k
                if (to_scale > from_scale) {
167
4.87k
                    multiply_may_overflow &=
168
4.87k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
4.87k
                }
170
4.87k
                return narrow_integral || multiply_may_overflow;
171
4.87k
            }
172
4.87k
            return false;
173
4.87k
        });
174
4.87k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
110
5.27k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
5.27k
        using Types = std::decay_t<decltype(types)>;
112
5.27k
        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.27k
        return call_on_index_and_data_type<
120
5.27k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
5.27k
            using Types2 = std::decay_t<decltype(types2)>;
122
5.27k
            using FromDataType = typename Types2::LeftType;
123
5.27k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
5.27k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
5.27k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
5.27k
                return false;
127
5.27k
            }
128
5.27k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
5.27k
                using FromFieldType = typename FromDataType::FieldType;
130
5.27k
                using ToFieldType = typename ToDataType::FieldType;
131
5.27k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
5.27k
                UInt32 from_scale = 0;
133
134
5.27k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
5.27k
                    const auto* from_decimal_type =
136
5.27k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
5.27k
                    from_precision =
138
5.27k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
5.27k
                    from_scale = from_decimal_type->get_scale();
140
5.27k
                }
141
142
5.27k
                UInt32 to_max_digits = 0;
143
5.27k
                UInt32 to_precision = 0;
144
5.27k
                UInt32 to_scale = 0;
145
146
5.27k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
5.27k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
5.27k
                    const auto* to_decimal_type =
150
5.27k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
5.27k
                    to_precision = to_decimal_type->get_precision();
152
5.27k
                    ToDataType::check_type_precision(to_precision);
153
154
5.27k
                    to_scale = to_decimal_type->get_scale();
155
5.27k
                    ToDataType::check_type_scale(to_scale);
156
5.27k
                }
157
5.27k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
5.27k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
5.27k
                    to_precision = to_max_digits;
160
5.27k
                }
161
162
5.27k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
5.27k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
5.27k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
5.27k
                if (to_scale > from_scale) {
167
5.27k
                    multiply_may_overflow &=
168
5.27k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
5.27k
                }
170
5.27k
                return narrow_integral || multiply_may_overflow;
171
5.27k
            }
172
5.27k
            return false;
173
5.27k
        });
174
5.27k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
110
35.5k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
35.5k
        using Types = std::decay_t<decltype(types)>;
112
35.5k
        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
35.5k
        return call_on_index_and_data_type<
120
35.5k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
35.5k
            using Types2 = std::decay_t<decltype(types2)>;
122
35.5k
            using FromDataType = typename Types2::LeftType;
123
35.5k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
35.5k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
35.5k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
35.5k
                return false;
127
35.5k
            }
128
35.5k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
35.5k
                using FromFieldType = typename FromDataType::FieldType;
130
35.5k
                using ToFieldType = typename ToDataType::FieldType;
131
35.5k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
35.5k
                UInt32 from_scale = 0;
133
134
35.5k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
35.5k
                    const auto* from_decimal_type =
136
35.5k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
35.5k
                    from_precision =
138
35.5k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
35.5k
                    from_scale = from_decimal_type->get_scale();
140
35.5k
                }
141
142
35.5k
                UInt32 to_max_digits = 0;
143
35.5k
                UInt32 to_precision = 0;
144
35.5k
                UInt32 to_scale = 0;
145
146
35.5k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
35.5k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
35.5k
                    const auto* to_decimal_type =
150
35.5k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
35.5k
                    to_precision = to_decimal_type->get_precision();
152
35.5k
                    ToDataType::check_type_precision(to_precision);
153
154
35.5k
                    to_scale = to_decimal_type->get_scale();
155
35.5k
                    ToDataType::check_type_scale(to_scale);
156
35.5k
                }
157
35.5k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
35.5k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
35.5k
                    to_precision = to_max_digits;
160
35.5k
                }
161
162
35.5k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
35.5k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
35.5k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
35.5k
                if (to_scale > from_scale) {
167
35.5k
                    multiply_may_overflow &=
168
35.5k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
35.5k
                }
170
35.5k
                return narrow_integral || multiply_may_overflow;
171
35.5k
            }
172
35.5k
            return false;
173
35.5k
        });
174
35.5k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
110
38.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
38.9k
        using Types = std::decay_t<decltype(types)>;
112
38.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
38.9k
        return call_on_index_and_data_type<
120
38.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
38.9k
            using Types2 = std::decay_t<decltype(types2)>;
122
38.9k
            using FromDataType = typename Types2::LeftType;
123
38.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
38.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
38.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
38.9k
                return false;
127
38.9k
            }
128
38.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
38.9k
                using FromFieldType = typename FromDataType::FieldType;
130
38.9k
                using ToFieldType = typename ToDataType::FieldType;
131
38.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
38.9k
                UInt32 from_scale = 0;
133
134
38.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
38.9k
                    const auto* from_decimal_type =
136
38.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
38.9k
                    from_precision =
138
38.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
38.9k
                    from_scale = from_decimal_type->get_scale();
140
38.9k
                }
141
142
38.9k
                UInt32 to_max_digits = 0;
143
38.9k
                UInt32 to_precision = 0;
144
38.9k
                UInt32 to_scale = 0;
145
146
38.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
38.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
38.9k
                    const auto* to_decimal_type =
150
38.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
38.9k
                    to_precision = to_decimal_type->get_precision();
152
38.9k
                    ToDataType::check_type_precision(to_precision);
153
154
38.9k
                    to_scale = to_decimal_type->get_scale();
155
38.9k
                    ToDataType::check_type_scale(to_scale);
156
38.9k
                }
157
38.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
38.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
38.9k
                    to_precision = to_max_digits;
160
38.9k
                }
161
162
38.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
38.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
38.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
38.9k
                if (to_scale > from_scale) {
167
38.9k
                    multiply_may_overflow &=
168
38.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
38.9k
                }
170
38.9k
                return narrow_integral || multiply_may_overflow;
171
38.9k
            }
172
38.9k
            return false;
173
38.9k
        });
174
38.9k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
110
5.32k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
5.32k
        using Types = std::decay_t<decltype(types)>;
112
5.32k
        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.32k
        return call_on_index_and_data_type<
120
5.32k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
5.32k
            using Types2 = std::decay_t<decltype(types2)>;
122
5.32k
            using FromDataType = typename Types2::LeftType;
123
5.32k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
5.32k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
5.32k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
5.32k
                return false;
127
5.32k
            }
128
5.32k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
5.32k
                using FromFieldType = typename FromDataType::FieldType;
130
5.32k
                using ToFieldType = typename ToDataType::FieldType;
131
5.32k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
5.32k
                UInt32 from_scale = 0;
133
134
5.32k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
5.32k
                    const auto* from_decimal_type =
136
5.32k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
5.32k
                    from_precision =
138
5.32k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
5.32k
                    from_scale = from_decimal_type->get_scale();
140
5.32k
                }
141
142
5.32k
                UInt32 to_max_digits = 0;
143
5.32k
                UInt32 to_precision = 0;
144
5.32k
                UInt32 to_scale = 0;
145
146
5.32k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
5.32k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
5.32k
                    const auto* to_decimal_type =
150
5.32k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
5.32k
                    to_precision = to_decimal_type->get_precision();
152
5.32k
                    ToDataType::check_type_precision(to_precision);
153
154
5.32k
                    to_scale = to_decimal_type->get_scale();
155
5.32k
                    ToDataType::check_type_scale(to_scale);
156
5.32k
                }
157
5.32k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
5.32k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
5.32k
                    to_precision = to_max_digits;
160
5.32k
                }
161
162
5.32k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
5.32k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
5.32k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
5.32k
                if (to_scale > from_scale) {
167
5.32k
                    multiply_may_overflow &=
168
5.32k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
5.32k
                }
170
5.32k
                return narrow_integral || multiply_may_overflow;
171
5.32k
            }
172
5.32k
            return false;
173
5.32k
        });
174
5.32k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
110
10.7k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
10.7k
        using Types = std::decay_t<decltype(types)>;
112
10.7k
        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.7k
        return call_on_index_and_data_type<
120
10.7k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
10.7k
            using Types2 = std::decay_t<decltype(types2)>;
122
10.7k
            using FromDataType = typename Types2::LeftType;
123
10.7k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
10.7k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
10.7k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
10.7k
                return false;
127
10.7k
            }
128
10.7k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
10.7k
                using FromFieldType = typename FromDataType::FieldType;
130
10.7k
                using ToFieldType = typename ToDataType::FieldType;
131
10.7k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
10.7k
                UInt32 from_scale = 0;
133
134
10.7k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
10.7k
                    const auto* from_decimal_type =
136
10.7k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
10.7k
                    from_precision =
138
10.7k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
10.7k
                    from_scale = from_decimal_type->get_scale();
140
10.7k
                }
141
142
10.7k
                UInt32 to_max_digits = 0;
143
10.7k
                UInt32 to_precision = 0;
144
10.7k
                UInt32 to_scale = 0;
145
146
10.7k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
10.7k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
10.7k
                    const auto* to_decimal_type =
150
10.7k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
10.7k
                    to_precision = to_decimal_type->get_precision();
152
10.7k
                    ToDataType::check_type_precision(to_precision);
153
154
10.7k
                    to_scale = to_decimal_type->get_scale();
155
10.7k
                    ToDataType::check_type_scale(to_scale);
156
10.7k
                }
157
10.7k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
10.7k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
10.7k
                    to_precision = to_max_digits;
160
10.7k
                }
161
162
10.7k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
10.7k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
10.7k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
10.7k
                if (to_scale > from_scale) {
167
10.7k
                    multiply_may_overflow &=
168
10.7k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
10.7k
                }
170
10.7k
                return narrow_integral || multiply_may_overflow;
171
10.7k
            }
172
10.7k
            return false;
173
10.7k
        });
174
10.7k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
110
28.0k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
28.0k
        using Types = std::decay_t<decltype(types)>;
112
28.0k
        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
28.0k
        return call_on_index_and_data_type<
120
28.0k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
28.0k
            using Types2 = std::decay_t<decltype(types2)>;
122
28.0k
            using FromDataType = typename Types2::LeftType;
123
28.0k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
28.0k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
28.0k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
28.0k
                return false;
127
28.0k
            }
128
28.0k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
28.0k
                using FromFieldType = typename FromDataType::FieldType;
130
28.0k
                using ToFieldType = typename ToDataType::FieldType;
131
28.0k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
28.0k
                UInt32 from_scale = 0;
133
134
28.0k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
28.0k
                    const auto* from_decimal_type =
136
28.0k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
28.0k
                    from_precision =
138
28.0k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
28.0k
                    from_scale = from_decimal_type->get_scale();
140
28.0k
                }
141
142
28.0k
                UInt32 to_max_digits = 0;
143
28.0k
                UInt32 to_precision = 0;
144
28.0k
                UInt32 to_scale = 0;
145
146
28.0k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
28.0k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
28.0k
                    const auto* to_decimal_type =
150
28.0k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
28.0k
                    to_precision = to_decimal_type->get_precision();
152
28.0k
                    ToDataType::check_type_precision(to_precision);
153
154
28.0k
                    to_scale = to_decimal_type->get_scale();
155
28.0k
                    ToDataType::check_type_scale(to_scale);
156
28.0k
                }
157
28.0k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
28.0k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
28.0k
                    to_precision = to_max_digits;
160
28.0k
                }
161
162
28.0k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
28.0k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
28.0k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
28.0k
                if (to_scale > from_scale) {
167
28.0k
                    multiply_may_overflow &=
168
28.0k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
28.0k
                }
170
28.0k
                return narrow_integral || multiply_may_overflow;
171
28.0k
            }
172
28.0k
            return false;
173
28.0k
        });
174
28.0k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
110
7.93k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
7.93k
        using Types = std::decay_t<decltype(types)>;
112
7.93k
        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.93k
        return call_on_index_and_data_type<
120
7.93k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7.93k
            using Types2 = std::decay_t<decltype(types2)>;
122
7.93k
            using FromDataType = typename Types2::LeftType;
123
7.93k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
7.93k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
7.93k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
7.93k
                return false;
127
7.93k
            }
128
7.93k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
7.93k
                using FromFieldType = typename FromDataType::FieldType;
130
7.93k
                using ToFieldType = typename ToDataType::FieldType;
131
7.93k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
7.93k
                UInt32 from_scale = 0;
133
134
7.93k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
7.93k
                    const auto* from_decimal_type =
136
7.93k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
7.93k
                    from_precision =
138
7.93k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
7.93k
                    from_scale = from_decimal_type->get_scale();
140
7.93k
                }
141
142
7.93k
                UInt32 to_max_digits = 0;
143
7.93k
                UInt32 to_precision = 0;
144
7.93k
                UInt32 to_scale = 0;
145
146
7.93k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
7.93k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
7.93k
                    const auto* to_decimal_type =
150
7.93k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
7.93k
                    to_precision = to_decimal_type->get_precision();
152
7.93k
                    ToDataType::check_type_precision(to_precision);
153
154
7.93k
                    to_scale = to_decimal_type->get_scale();
155
7.93k
                    ToDataType::check_type_scale(to_scale);
156
7.93k
                }
157
7.93k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
7.93k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
7.93k
                    to_precision = to_max_digits;
160
7.93k
                }
161
162
7.93k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
7.93k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
7.93k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
7.93k
                if (to_scale > from_scale) {
167
7.93k
                    multiply_may_overflow &=
168
7.93k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
7.93k
                }
170
7.93k
                return narrow_integral || multiply_may_overflow;
171
7.93k
            }
172
7.93k
            return false;
173
7.93k
        });
174
7.93k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
110
15.2k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
15.2k
        using Types = std::decay_t<decltype(types)>;
112
15.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
15.2k
        return call_on_index_and_data_type<
120
15.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
15.2k
            using Types2 = std::decay_t<decltype(types2)>;
122
15.2k
            using FromDataType = typename Types2::LeftType;
123
15.2k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
15.2k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
15.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
15.2k
                return false;
127
15.2k
            }
128
15.2k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
15.2k
                using FromFieldType = typename FromDataType::FieldType;
130
15.2k
                using ToFieldType = typename ToDataType::FieldType;
131
15.2k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
15.2k
                UInt32 from_scale = 0;
133
134
15.2k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
15.2k
                    const auto* from_decimal_type =
136
15.2k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
15.2k
                    from_precision =
138
15.2k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
15.2k
                    from_scale = from_decimal_type->get_scale();
140
15.2k
                }
141
142
15.2k
                UInt32 to_max_digits = 0;
143
15.2k
                UInt32 to_precision = 0;
144
15.2k
                UInt32 to_scale = 0;
145
146
15.2k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
15.2k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
15.2k
                    const auto* to_decimal_type =
150
15.2k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
15.2k
                    to_precision = to_decimal_type->get_precision();
152
15.2k
                    ToDataType::check_type_precision(to_precision);
153
154
15.2k
                    to_scale = to_decimal_type->get_scale();
155
15.2k
                    ToDataType::check_type_scale(to_scale);
156
15.2k
                }
157
15.2k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
15.2k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
15.2k
                    to_precision = to_max_digits;
160
15.2k
                }
161
162
15.2k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
15.2k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
15.2k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
15.2k
                if (to_scale > from_scale) {
167
15.2k
                    multiply_may_overflow &=
168
15.2k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
15.2k
                }
170
15.2k
                return narrow_integral || multiply_may_overflow;
171
15.2k
            }
172
15.2k
            return false;
173
15.2k
        });
174
15.2k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
110
226
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
226
        using Types = std::decay_t<decltype(types)>;
112
226
        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
226
        return call_on_index_and_data_type<
120
226
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
226
            using Types2 = std::decay_t<decltype(types2)>;
122
226
            using FromDataType = typename Types2::LeftType;
123
226
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
226
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
226
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
226
                return false;
127
226
            }
128
226
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
226
                using FromFieldType = typename FromDataType::FieldType;
130
226
                using ToFieldType = typename ToDataType::FieldType;
131
226
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
226
                UInt32 from_scale = 0;
133
134
226
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
226
                    const auto* from_decimal_type =
136
226
                            check_and_get_data_type<FromDataType>(from_type.get());
137
226
                    from_precision =
138
226
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
226
                    from_scale = from_decimal_type->get_scale();
140
226
                }
141
142
226
                UInt32 to_max_digits = 0;
143
226
                UInt32 to_precision = 0;
144
226
                UInt32 to_scale = 0;
145
146
226
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
226
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
226
                    const auto* to_decimal_type =
150
226
                            check_and_get_data_type<ToDataType>(to_type.get());
151
226
                    to_precision = to_decimal_type->get_precision();
152
226
                    ToDataType::check_type_precision(to_precision);
153
154
226
                    to_scale = to_decimal_type->get_scale();
155
226
                    ToDataType::check_type_scale(to_scale);
156
226
                }
157
226
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
226
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
226
                    to_precision = to_max_digits;
160
226
                }
161
162
226
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
226
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
226
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
226
                if (to_scale > from_scale) {
167
226
                    multiply_may_overflow &=
168
226
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
226
                }
170
226
                return narrow_integral || multiply_may_overflow;
171
226
            }
172
226
            return false;
173
226
        });
174
226
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
110
15.0k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
15.0k
        using Types = std::decay_t<decltype(types)>;
112
15.0k
        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
15.0k
        return call_on_index_and_data_type<
120
15.0k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
15.0k
            using Types2 = std::decay_t<decltype(types2)>;
122
15.0k
            using FromDataType = typename Types2::LeftType;
123
15.0k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
15.0k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
15.0k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
15.0k
                return false;
127
15.0k
            }
128
15.0k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
15.0k
                using FromFieldType = typename FromDataType::FieldType;
130
15.0k
                using ToFieldType = typename ToDataType::FieldType;
131
15.0k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
15.0k
                UInt32 from_scale = 0;
133
134
15.0k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
15.0k
                    const auto* from_decimal_type =
136
15.0k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
15.0k
                    from_precision =
138
15.0k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
15.0k
                    from_scale = from_decimal_type->get_scale();
140
15.0k
                }
141
142
15.0k
                UInt32 to_max_digits = 0;
143
15.0k
                UInt32 to_precision = 0;
144
15.0k
                UInt32 to_scale = 0;
145
146
15.0k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
15.0k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
15.0k
                    const auto* to_decimal_type =
150
15.0k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
15.0k
                    to_precision = to_decimal_type->get_precision();
152
15.0k
                    ToDataType::check_type_precision(to_precision);
153
154
15.0k
                    to_scale = to_decimal_type->get_scale();
155
15.0k
                    ToDataType::check_type_scale(to_scale);
156
15.0k
                }
157
15.0k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
15.0k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
15.0k
                    to_precision = to_max_digits;
160
15.0k
                }
161
162
15.0k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
15.0k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
15.0k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
15.0k
                if (to_scale > from_scale) {
167
15.0k
                    multiply_may_overflow &=
168
15.0k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
15.0k
                }
170
15.0k
                return narrow_integral || multiply_may_overflow;
171
15.0k
            }
172
15.0k
            return false;
173
15.0k
        });
174
15.0k
    };
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.94k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
7.94k
        using Types = std::decay_t<decltype(types)>;
112
7.94k
        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.94k
        return call_on_index_and_data_type<
120
7.94k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
7.94k
            using Types2 = std::decay_t<decltype(types2)>;
122
7.94k
            using FromDataType = typename Types2::LeftType;
123
7.94k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
7.94k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
7.94k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
7.94k
                return false;
127
7.94k
            }
128
7.94k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
7.94k
                using FromFieldType = typename FromDataType::FieldType;
130
7.94k
                using ToFieldType = typename ToDataType::FieldType;
131
7.94k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
7.94k
                UInt32 from_scale = 0;
133
134
7.94k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
7.94k
                    const auto* from_decimal_type =
136
7.94k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
7.94k
                    from_precision =
138
7.94k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
7.94k
                    from_scale = from_decimal_type->get_scale();
140
7.94k
                }
141
142
7.94k
                UInt32 to_max_digits = 0;
143
7.94k
                UInt32 to_precision = 0;
144
7.94k
                UInt32 to_scale = 0;
145
146
7.94k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
7.94k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
7.94k
                    const auto* to_decimal_type =
150
7.94k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
7.94k
                    to_precision = to_decimal_type->get_precision();
152
7.94k
                    ToDataType::check_type_precision(to_precision);
153
154
7.94k
                    to_scale = to_decimal_type->get_scale();
155
7.94k
                    ToDataType::check_type_scale(to_scale);
156
7.94k
                }
157
7.94k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
7.94k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
7.94k
                    to_precision = to_max_digits;
160
7.94k
                }
161
162
7.94k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
7.94k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
7.94k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
7.94k
                if (to_scale > from_scale) {
167
7.94k
                    multiply_may_overflow &=
168
7.94k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
7.94k
                }
170
7.94k
                return narrow_integral || multiply_may_overflow;
171
7.94k
            }
172
7.94k
            return false;
173
7.94k
        });
174
7.94k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
110
4.92k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
4.92k
        using Types = std::decay_t<decltype(types)>;
112
4.92k
        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.92k
        return call_on_index_and_data_type<
120
4.92k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
4.92k
            using Types2 = std::decay_t<decltype(types2)>;
122
4.92k
            using FromDataType = typename Types2::LeftType;
123
4.92k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
4.92k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
4.92k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
4.92k
                return false;
127
4.92k
            }
128
4.92k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
4.92k
                using FromFieldType = typename FromDataType::FieldType;
130
4.92k
                using ToFieldType = typename ToDataType::FieldType;
131
4.92k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
4.92k
                UInt32 from_scale = 0;
133
134
4.92k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
4.92k
                    const auto* from_decimal_type =
136
4.92k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
4.92k
                    from_precision =
138
4.92k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
4.92k
                    from_scale = from_decimal_type->get_scale();
140
4.92k
                }
141
142
4.92k
                UInt32 to_max_digits = 0;
143
4.92k
                UInt32 to_precision = 0;
144
4.92k
                UInt32 to_scale = 0;
145
146
4.92k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
4.92k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
4.92k
                    const auto* to_decimal_type =
150
4.92k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
4.92k
                    to_precision = to_decimal_type->get_precision();
152
4.92k
                    ToDataType::check_type_precision(to_precision);
153
154
4.92k
                    to_scale = to_decimal_type->get_scale();
155
4.92k
                    ToDataType::check_type_scale(to_scale);
156
4.92k
                }
157
4.92k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
4.92k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
4.92k
                    to_precision = to_max_digits;
160
4.92k
                }
161
162
4.92k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
4.92k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
4.92k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
4.92k
                if (to_scale > from_scale) {
167
4.92k
                    multiply_may_overflow &=
168
4.92k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
4.92k
                }
170
4.92k
                return narrow_integral || multiply_may_overflow;
171
4.92k
            }
172
4.92k
            return false;
173
4.92k
        });
174
4.92k
    };
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
459
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
459
        using Types = std::decay_t<decltype(types)>;
112
459
        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
459
        return call_on_index_and_data_type<
120
459
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
459
            using Types2 = std::decay_t<decltype(types2)>;
122
459
            using FromDataType = typename Types2::LeftType;
123
459
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
459
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
459
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
459
                return false;
127
459
            }
128
459
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
459
                using FromFieldType = typename FromDataType::FieldType;
130
459
                using ToFieldType = typename ToDataType::FieldType;
131
459
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
459
                UInt32 from_scale = 0;
133
134
459
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
459
                    const auto* from_decimal_type =
136
459
                            check_and_get_data_type<FromDataType>(from_type.get());
137
459
                    from_precision =
138
459
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
459
                    from_scale = from_decimal_type->get_scale();
140
459
                }
141
142
459
                UInt32 to_max_digits = 0;
143
459
                UInt32 to_precision = 0;
144
459
                UInt32 to_scale = 0;
145
146
459
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
459
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
459
                    const auto* to_decimal_type =
150
459
                            check_and_get_data_type<ToDataType>(to_type.get());
151
459
                    to_precision = to_decimal_type->get_precision();
152
459
                    ToDataType::check_type_precision(to_precision);
153
154
459
                    to_scale = to_decimal_type->get_scale();
155
459
                    ToDataType::check_type_scale(to_scale);
156
459
                }
157
459
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
459
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
459
                    to_precision = to_max_digits;
160
459
                }
161
162
459
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
459
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
459
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
459
                if (to_scale > from_scale) {
167
459
                    multiply_may_overflow &=
168
459
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
459
                }
170
459
                return narrow_integral || multiply_may_overflow;
171
459
            }
172
459
            return false;
173
459
        });
174
459
    };
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
551
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
551
        using Types = std::decay_t<decltype(types)>;
112
551
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
551
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
551
            return false;
118
551
        }
119
0
        return call_on_index_and_data_type<
120
551
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
551
            using Types2 = std::decay_t<decltype(types2)>;
122
551
            using FromDataType = typename Types2::LeftType;
123
551
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
551
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
551
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
551
                return false;
127
551
            }
128
551
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
551
                using FromFieldType = typename FromDataType::FieldType;
130
551
                using ToFieldType = typename ToDataType::FieldType;
131
551
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
551
                UInt32 from_scale = 0;
133
134
551
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
551
                    const auto* from_decimal_type =
136
551
                            check_and_get_data_type<FromDataType>(from_type.get());
137
551
                    from_precision =
138
551
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
551
                    from_scale = from_decimal_type->get_scale();
140
551
                }
141
142
551
                UInt32 to_max_digits = 0;
143
551
                UInt32 to_precision = 0;
144
551
                UInt32 to_scale = 0;
145
146
551
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
551
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
551
                    const auto* to_decimal_type =
150
551
                            check_and_get_data_type<ToDataType>(to_type.get());
151
551
                    to_precision = to_decimal_type->get_precision();
152
551
                    ToDataType::check_type_precision(to_precision);
153
154
551
                    to_scale = to_decimal_type->get_scale();
155
551
                    ToDataType::check_type_scale(to_scale);
156
551
                }
157
551
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
551
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
551
                    to_precision = to_max_digits;
160
551
                }
161
162
551
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
551
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
551
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
551
                if (to_scale > from_scale) {
167
551
                    multiply_may_overflow &=
168
551
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
551
                }
170
551
                return narrow_integral || multiply_may_overflow;
171
551
            }
172
551
            return false;
173
551
        });
174
551
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_
Line
Count
Source
110
292
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
292
        using Types = std::decay_t<decltype(types)>;
112
292
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
292
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
292
            return false;
118
292
        }
119
0
        return call_on_index_and_data_type<
120
292
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
292
            using Types2 = std::decay_t<decltype(types2)>;
122
292
            using FromDataType = typename Types2::LeftType;
123
292
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
292
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
292
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
292
                return false;
127
292
            }
128
292
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
292
                using FromFieldType = typename FromDataType::FieldType;
130
292
                using ToFieldType = typename ToDataType::FieldType;
131
292
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
292
                UInt32 from_scale = 0;
133
134
292
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
292
                    const auto* from_decimal_type =
136
292
                            check_and_get_data_type<FromDataType>(from_type.get());
137
292
                    from_precision =
138
292
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
292
                    from_scale = from_decimal_type->get_scale();
140
292
                }
141
142
292
                UInt32 to_max_digits = 0;
143
292
                UInt32 to_precision = 0;
144
292
                UInt32 to_scale = 0;
145
146
292
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
292
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
292
                    const auto* to_decimal_type =
150
292
                            check_and_get_data_type<ToDataType>(to_type.get());
151
292
                    to_precision = to_decimal_type->get_precision();
152
292
                    ToDataType::check_type_precision(to_precision);
153
154
292
                    to_scale = to_decimal_type->get_scale();
155
292
                    ToDataType::check_type_scale(to_scale);
156
292
                }
157
292
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
292
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
292
                    to_precision = to_max_digits;
160
292
                }
161
162
292
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
292
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
292
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
292
                if (to_scale > from_scale) {
167
292
                    multiply_may_overflow &=
168
292
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
292
                }
170
292
                return narrow_integral || multiply_may_overflow;
171
292
            }
172
292
            return false;
173
292
        });
174
292
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_
Line
Count
Source
110
33.4k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
33.4k
        using Types = std::decay_t<decltype(types)>;
112
33.4k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
33.4k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
33.4k
            return false;
118
33.4k
        }
119
0
        return call_on_index_and_data_type<
120
33.4k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
33.4k
            using Types2 = std::decay_t<decltype(types2)>;
122
33.4k
            using FromDataType = typename Types2::LeftType;
123
33.4k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
33.4k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
33.4k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
33.4k
                return false;
127
33.4k
            }
128
33.4k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
33.4k
                using FromFieldType = typename FromDataType::FieldType;
130
33.4k
                using ToFieldType = typename ToDataType::FieldType;
131
33.4k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
33.4k
                UInt32 from_scale = 0;
133
134
33.4k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
33.4k
                    const auto* from_decimal_type =
136
33.4k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
33.4k
                    from_precision =
138
33.4k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
33.4k
                    from_scale = from_decimal_type->get_scale();
140
33.4k
                }
141
142
33.4k
                UInt32 to_max_digits = 0;
143
33.4k
                UInt32 to_precision = 0;
144
33.4k
                UInt32 to_scale = 0;
145
146
33.4k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
33.4k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
33.4k
                    const auto* to_decimal_type =
150
33.4k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
33.4k
                    to_precision = to_decimal_type->get_precision();
152
33.4k
                    ToDataType::check_type_precision(to_precision);
153
154
33.4k
                    to_scale = to_decimal_type->get_scale();
155
33.4k
                    ToDataType::check_type_scale(to_scale);
156
33.4k
                }
157
33.4k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
33.4k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
33.4k
                    to_precision = to_max_digits;
160
33.4k
                }
161
162
33.4k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
33.4k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
33.4k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
33.4k
                if (to_scale > from_scale) {
167
33.4k
                    multiply_may_overflow &=
168
33.4k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
33.4k
                }
170
33.4k
                return narrow_integral || multiply_may_overflow;
171
33.4k
            }
172
33.4k
            return false;
173
33.4k
        });
174
33.4k
    };
175
176
308k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
177
377k
}
178
179
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
180
407k
                                    const DataTypePtr& to_type) {
181
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
182
407k
    bool result_is_nullable = to_type->is_nullable();
183
184
407k
    if (result_is_nullable) {
185
377k
        return [from_type, to_type](FunctionContext* context, Block& block,
186
377k
                                    const ColumnNumbers& arguments, uint32_t result,
187
377k
                                    size_t input_rows_count,
188
377k
                                    const NullMap::value_type* null_map = nullptr) {
189
377k
            auto from_type_not_nullable = remove_nullable(from_type);
190
377k
            auto to_type_not_nullable = remove_nullable(to_type);
191
192
377k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
193
377k
                    context, from_type_not_nullable, to_type_not_nullable);
194
195
377k
            auto nested_result_index = block.columns();
196
377k
            block.insert(block.get_by_position(result).unnest_nullable());
197
377k
            auto nested_source_index = block.columns();
198
377k
            block.insert(block.get_by_position(arguments[0])
199
377k
                                 .unnest_nullable(replace_null_data_to_default));
200
201
377k
            const auto& arg_col = block.get_by_position(arguments[0]);
202
377k
            const NullMap::value_type* arg_null_map = nullptr;
203
377k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
204
331k
                arg_null_map = nullable->get_null_map_data().data();
205
331k
            }
206
377k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
207
377k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
208
377k
                    arg_null_map));
209
210
352k
            block.get_by_position(result).column =
211
352k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
212
352k
                                     arguments, input_rows_count);
213
214
352k
            block.erase(nested_source_index);
215
352k
            block.erase(nested_result_index);
216
352k
            return Status::OK();
217
377k
        };
218
377k
    } else {
219
29.3k
        return prepare_impl(context, from_type, to_type);
220
29.3k
    }
221
407k
}
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
426k
                         const DataTypePtr& origin_to_type) {
227
426k
    auto to_type = get_serialized_type(origin_to_type);
228
426k
    auto from_type = get_serialized_type(origin_from_type);
229
426k
    if (from_type->equals(*to_type)) {
230
77.7k
        return create_identity_wrapper(from_type);
231
77.7k
    }
232
233
    // variant needs to be judged first
234
348k
    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
336k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
239
21.2k
        return create_cast_from_variant_wrapper(static_cast<const DataTypeVariant&>(*from_type),
240
21.2k
                                                to_type);
241
21.2k
    }
242
243
315k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
244
9.33k
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
245
9.33k
                                              to_type,
246
9.33k
                                              context ? context->jsonb_string_as_string() : false);
247
9.33k
    }
248
249
306k
    switch (to_type->get_primitive_type()) {
250
1.03k
    case PrimitiveType::TYPE_BOOLEAN:
251
1.03k
        return create_boolean_wrapper(context, from_type);
252
4.96k
    case PrimitiveType::TYPE_TINYINT:
253
10.2k
    case PrimitiveType::TYPE_SMALLINT:
254
43.7k
    case PrimitiveType::TYPE_INT:
255
88.3k
    case PrimitiveType::TYPE_BIGINT:
256
93.1k
    case PrimitiveType::TYPE_LARGEINT:
257
93.1k
        return create_int_wrapper(context, from_type, to_type->get_primitive_type());
258
10.9k
    case PrimitiveType::TYPE_FLOAT:
259
40.5k
    case PrimitiveType::TYPE_DOUBLE:
260
40.5k
        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
8.04k
    case PrimitiveType::TYPE_DATEV2:
264
13.3k
    case PrimitiveType::TYPE_DATETIMEV2:
265
13.8k
    case PrimitiveType::TYPE_TIMEV2:
266
13.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
483
    case PrimitiveType::TYPE_IPV4:
270
775
    case PrimitiveType::TYPE_IPV6:
271
775
        return create_ip_wrapper(context, from_type, to_type->get_primitive_type());
272
292
    case PrimitiveType::TYPE_DECIMALV2:
273
8.32k
    case PrimitiveType::TYPE_DECIMAL32:
274
26.7k
    case PrimitiveType::TYPE_DECIMAL64:
275
44.5k
    case PrimitiveType::TYPE_DECIMAL128I:
276
55.5k
    case PrimitiveType::TYPE_DECIMAL256:
277
55.5k
        return create_decimal_wrapper(context, from_type, to_type->get_primitive_type());
278
20
    case PrimitiveType::TYPE_CHAR:
279
6.95k
    case PrimitiveType::TYPE_VARCHAR:
280
29.0k
    case PrimitiveType::TYPE_STRING:
281
29.0k
        return create_string_wrapper(from_type);
282
7.22k
    case PrimitiveType::TYPE_ARRAY:
283
7.22k
        return create_array_wrapper(context, from_type,
284
7.22k
                                    static_cast<const DataTypeArray&>(*to_type));
285
3.12k
    case PrimitiveType::TYPE_STRUCT:
286
3.12k
        return create_struct_wrapper(context, from_type,
287
3.12k
                                     static_cast<const DataTypeStruct&>(*to_type));
288
2.53k
    case PrimitiveType::TYPE_MAP:
289
2.53k
        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
306k
    }
306
307
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
308
306k
}
309
310
} // namespace CastWrapper
311
312
class PreparedFunctionCast : public PreparedFunctionImpl {
313
public:
314
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
315
392k
            : 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
392k
                        uint32_t result, size_t input_rows_count) const override {
322
392k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
323
392k
    }
324
325
392k
    bool use_default_implementation_for_nulls() const override { return false; }
326
391k
    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
294k
            : name(name_),
337
294k
              argument_types(std::move(argument_types_)),
338
294k
              return_type(std::move(return_type_)) {}
339
340
392k
    const DataTypes& get_argument_types() const override { return argument_types; }
341
392k
    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
392k
                                uint32_t /*result*/) const override {
346
392k
        return std::make_shared<PreparedFunctionCast>(
347
392k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
348
392k
                                                         get_return_type()),
349
392k
                name);
350
392k
    }
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
294k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
367
368
294k
    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
293k
                               const DataTypePtr& return_type) const override {
379
293k
        DataTypes data_types(arguments.size());
380
381
882k
        for (size_t i = 0; i < arguments.size(); ++i) {
382
588k
            data_types[i] = arguments[i].type;
383
588k
        }
384
385
293k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
386
293k
    }
387
388
294k
    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