Coverage Report

Created: 2026-04-01 03:37

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
0
                               const DataTypeHLL& to_type) {
39
    /// Conversion from String through parsing.
40
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
41
0
        return cast_from_string_to_generic;
42
0
    }
43
44
0
    return CastWrapper::create_unsupport_wrapper("Cast to HLL only support from String type");
45
0
}
46
47
WrapperType create_bitmap_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
48
0
                                  const DataTypeBitMap& to_type) {
49
    /// Conversion from String through parsing.
50
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
51
0
        return cast_from_string_to_generic;
52
0
    }
53
54
0
    return CastWrapper::create_unsupport_wrapper("Cast to BitMap only support from String type");
55
0
}
56
57
WrapperType create_quantile_state_wrapper(FunctionContext* context,
58
                                          const DataTypePtr& from_type_untyped,
59
0
                                          const DataTypeQuantileState& to_type) {
60
    /// Conversion from String through parsing.
61
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
62
0
        return cast_from_string_to_generic;
63
0
    }
64
65
0
    return CastWrapper::create_unsupport_wrapper(
66
0
            "Cast to QuantileState only support from String type");
67
0
}
68
69
0
WrapperType create_varbinary_wrapper(const DataTypePtr& from_type_untyped) {
70
    /// Conversion from String through parsing.
71
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
72
0
        return cast_from_string_to_generic;
73
0
    }
74
75
0
    return CastWrapper::create_unsupport_wrapper("Cast to Varbinary only support from String type");
76
0
}
77
78
WrapperType prepare_unpack_dictionaries(FunctionContext* context, const DataTypePtr& from_type,
79
84.9k
                                        const DataTypePtr& to_type) {
80
84.9k
    const auto& from_nested = from_type;
81
84.9k
    const auto& to_nested = to_type;
82
83
84.9k
    if (from_type->is_null_literal()) {
84
0
        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
0
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
90
0
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
91
            /// TODO: remove this in the future.
92
0
            auto& res = block.get_by_position(result);
93
0
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
94
0
                                 ->convert_to_full_column_if_const();
95
0
            return Status::OK();
96
0
        };
97
0
    }
98
99
84.9k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
100
101
84.9k
    return wrapper;
102
84.9k
}
103
104
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
105
84.9k
                                       const DataTypePtr& to_type) {
106
84.9k
    if (from_type->equals(*to_type)) {
107
126
        return false;
108
126
    }
109
110
84.8k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
35.2k
        using Types = std::decay_t<decltype(types)>;
112
35.2k
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
48
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
48
            return false;
118
48
        }
119
0
        return call_on_index_and_data_type<
120
35.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
35.0k
            using Types2 = std::decay_t<decltype(types2)>;
122
35.0k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
10.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
10.2k
                return false;
127
10.2k
            }
128
12.8k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
12.8k
                using FromFieldType = typename FromDataType::FieldType;
130
12.8k
                using ToFieldType = typename ToDataType::FieldType;
131
12.8k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
12.8k
                UInt32 from_scale = 0;
133
134
12.8k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
5.45k
                    const auto* from_decimal_type =
136
5.45k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
5.45k
                    from_precision =
138
5.45k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
5.45k
                    from_scale = from_decimal_type->get_scale();
140
5.45k
                }
141
142
12.8k
                UInt32 to_max_digits = 0;
143
12.8k
                UInt32 to_precision = 0;
144
12.8k
                UInt32 to_scale = 0;
145
146
12.8k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
12.3k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
12.3k
                    const auto* to_decimal_type =
150
12.3k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
12.3k
                    to_precision = to_decimal_type->get_precision();
152
12.3k
                    ToDataType::check_type_precision(to_precision);
153
154
12.3k
                    to_scale = to_decimal_type->get_scale();
155
12.3k
                    ToDataType::check_type_scale(to_scale);
156
12.3k
                }
157
12.8k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
573
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
573
                    to_precision = to_max_digits;
160
573
                }
161
162
12.8k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
12.8k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
12.8k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
12.8k
                if (to_scale > from_scale) {
167
3.13k
                    multiply_may_overflow &=
168
3.13k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
3.13k
                }
170
12.8k
                return narrow_integral || multiply_may_overflow;
171
12.8k
            }
172
0
            return false;
173
35.0k
        });
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_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
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
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_6EEESE_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_7EEESE_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_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
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_INS_15DataTypeDecimalILSD_28EEESE_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_29EEESE_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_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
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_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
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
12
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
12
                return false;
127
12
            }
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_13PrimitiveTypeE3EEEvEEEEbRKT_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
        });
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
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_5EEESE_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_6EEESE_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_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
27
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
27
            using Types2 = std::decay_t<decltype(types2)>;
122
27
            using FromDataType = typename 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
27
            return false;
173
27
        });
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
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_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_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_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
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_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_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
        });
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
857
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
857
            using Types2 = std::decay_t<decltype(types2)>;
122
857
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
857
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
857
                return false;
127
857
            }
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
857
            return false;
173
857
        });
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
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_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_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
        });
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
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_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_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_13PrimitiveTypeE4EEEvEEEEbRKT_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_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
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_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_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_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
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_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_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
        });
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
841
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
841
            using Types2 = std::decay_t<decltype(types2)>;
122
841
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
841
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
841
                return false;
127
841
            }
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
841
            return false;
173
841
        });
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
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_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_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_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_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
        });
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
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_13PrimitiveTypeE5EEEvEEEEbRKT_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_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_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
            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
17
            return false;
173
17
        });
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
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_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_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_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_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_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
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_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_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
        });
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
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_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
825
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
825
            using Types2 = std::decay_t<decltype(types2)>;
122
825
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
825
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
825
                return false;
127
825
            }
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
825
            return false;
173
825
        });
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
71
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
71
            using Types2 = std::decay_t<decltype(types2)>;
122
71
            using FromDataType = typename 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
71
            return false;
173
71
        });
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
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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_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
        });
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
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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_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
            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
17
            return false;
173
17
        });
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
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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_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_13PrimitiveTypeE6EEEvEEEEbRKT_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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_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
        });
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
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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_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
            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_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
809
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
809
            using Types2 = std::decay_t<decltype(types2)>;
122
809
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
809
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
809
                return false;
127
809
            }
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
809
            return false;
173
809
        });
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
85
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
85
            using Types2 = std::decay_t<decltype(types2)>;
122
85
            using FromDataType = typename 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
85
            return false;
173
85
        });
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
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_INSC_ILSD_4EEESE_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_INSC_ILSD_5EEESE_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_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
120
91
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
91
            using Types2 = std::decay_t<decltype(types2)>;
122
91
            using FromDataType = typename 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
91
            return false;
173
91
        });
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
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_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_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_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
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_35EEESE_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
        });
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
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_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
793
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
793
            using Types2 = std::decay_t<decltype(types2)>;
122
793
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
793
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
793
                return false;
127
793
            }
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
793
            return false;
173
793
        });
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
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_4EEESE_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_5EEESE_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_6EEESE_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_7EEESE_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
        });
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
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_INS_15DataTypeDecimalILSD_28EEESE_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_29EEESE_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_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
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_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
120
36
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
36
            using Types2 = std::decay_t<decltype(types2)>;
122
36
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
36
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
36
                using FromFieldType = typename FromDataType::FieldType;
130
36
                using ToFieldType = typename ToDataType::FieldType;
131
36
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
36
                UInt32 from_scale = 0;
133
134
36
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
36
                    const auto* from_decimal_type =
136
36
                            check_and_get_data_type<FromDataType>(from_type.get());
137
36
                    from_precision =
138
36
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
36
                    from_scale = from_decimal_type->get_scale();
140
36
                }
141
142
36
                UInt32 to_max_digits = 0;
143
36
                UInt32 to_precision = 0;
144
36
                UInt32 to_scale = 0;
145
146
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
                    const auto* to_decimal_type =
150
                            check_and_get_data_type<ToDataType>(to_type.get());
151
                    to_precision = to_decimal_type->get_precision();
152
                    ToDataType::check_type_precision(to_precision);
153
154
                    to_scale = to_decimal_type->get_scale();
155
                    ToDataType::check_type_scale(to_scale);
156
                }
157
36
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
36
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
36
                    to_precision = to_max_digits;
160
36
                }
161
162
36
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
36
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
36
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
36
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
36
                return narrow_integral || multiply_may_overflow;
171
36
            }
172
0
            return false;
173
36
        });
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
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
            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
37
            return false;
173
37
        });
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
80
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
80
            using Types2 = std::decay_t<decltype(types2)>;
122
80
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
80
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
80
                return false;
127
80
            }
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
80
            return false;
173
80
        });
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
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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_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_13PrimitiveTypeE9EEEvEEEEbRKT_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
        });
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
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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_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_13PrimitiveTypeE9EEEvEEEEbRKT_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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_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
        });
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
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
            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
37
            return false;
173
37
        });
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.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_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
80
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
80
            using Types2 = std::decay_t<decltype(types2)>;
122
80
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
80
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
80
                return false;
127
80
            }
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
80
            return false;
173
80
        });
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
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_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
34
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
34
            using Types2 = std::decay_t<decltype(types2)>;
122
34
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
34
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
34
                using FromFieldType = typename FromDataType::FieldType;
130
34
                using ToFieldType = typename ToDataType::FieldType;
131
34
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
34
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
34
                UInt32 to_max_digits = 0;
143
34
                UInt32 to_precision = 0;
144
34
                UInt32 to_scale = 0;
145
146
34
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
34
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
34
                    const auto* to_decimal_type =
150
34
                            check_and_get_data_type<ToDataType>(to_type.get());
151
34
                    to_precision = to_decimal_type->get_precision();
152
34
                    ToDataType::check_type_precision(to_precision);
153
154
34
                    to_scale = to_decimal_type->get_scale();
155
34
                    ToDataType::check_type_scale(to_scale);
156
34
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
34
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
34
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
34
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
34
                if (to_scale > from_scale) {
167
23
                    multiply_may_overflow &=
168
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
23
                }
170
34
                return narrow_integral || multiply_may_overflow;
171
34
            }
172
0
            return false;
173
34
        });
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
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
39
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
39
                using FromFieldType = typename FromDataType::FieldType;
130
39
                using ToFieldType = typename ToDataType::FieldType;
131
39
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
39
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
39
                UInt32 to_max_digits = 0;
143
39
                UInt32 to_precision = 0;
144
39
                UInt32 to_scale = 0;
145
146
39
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
39
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
39
                    const auto* to_decimal_type =
150
39
                            check_and_get_data_type<ToDataType>(to_type.get());
151
39
                    to_precision = to_decimal_type->get_precision();
152
39
                    ToDataType::check_type_precision(to_precision);
153
154
39
                    to_scale = to_decimal_type->get_scale();
155
39
                    ToDataType::check_type_scale(to_scale);
156
39
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
39
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
39
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
39
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
39
                if (to_scale > from_scale) {
167
23
                    multiply_may_overflow &=
168
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
23
                }
170
39
                return narrow_integral || multiply_may_overflow;
171
39
            }
172
0
            return false;
173
39
        });
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
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
28
                    multiply_may_overflow &=
168
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
28
                }
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_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_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
28
                    multiply_may_overflow &=
168
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
28
                }
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_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_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
28
                    multiply_may_overflow &=
168
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
28
                }
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_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_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
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
99
                UInt32 to_max_digits = 0;
143
99
                UInt32 to_precision = 0;
144
99
                UInt32 to_scale = 0;
145
146
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
99
                    const auto* to_decimal_type =
150
99
                            check_and_get_data_type<ToDataType>(to_type.get());
151
99
                    to_precision = to_decimal_type->get_precision();
152
99
                    ToDataType::check_type_precision(to_precision);
153
154
99
                    to_scale = to_decimal_type->get_scale();
155
99
                    ToDataType::check_type_scale(to_scale);
156
99
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
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
66
                    multiply_may_overflow &=
168
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
66
                }
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_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
103
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
103
            using Types2 = std::decay_t<decltype(types2)>;
122
103
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
103
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
103
                using FromFieldType = typename FromDataType::FieldType;
130
103
                using ToFieldType = typename ToDataType::FieldType;
131
103
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
103
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
103
                UInt32 to_max_digits = 0;
143
103
                UInt32 to_precision = 0;
144
103
                UInt32 to_scale = 0;
145
146
103
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
103
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
103
                    const auto* to_decimal_type =
150
103
                            check_and_get_data_type<ToDataType>(to_type.get());
151
103
                    to_precision = to_decimal_type->get_precision();
152
103
                    ToDataType::check_type_precision(to_precision);
153
154
103
                    to_scale = to_decimal_type->get_scale();
155
103
                    ToDataType::check_type_scale(to_scale);
156
103
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
103
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
103
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
103
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
103
                if (to_scale > from_scale) {
167
66
                    multiply_may_overflow &=
168
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
66
                }
170
103
                return narrow_integral || multiply_may_overflow;
171
103
            }
172
0
            return false;
173
103
        });
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
128
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
128
            using Types2 = std::decay_t<decltype(types2)>;
122
128
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
128
                using FromFieldType = typename FromDataType::FieldType;
130
128
                using ToFieldType = typename ToDataType::FieldType;
131
128
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
128
                UInt32 from_scale = 0;
133
134
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
128
                    const auto* from_decimal_type =
136
128
                            check_and_get_data_type<FromDataType>(from_type.get());
137
128
                    from_precision =
138
128
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
128
                    from_scale = from_decimal_type->get_scale();
140
128
                }
141
142
128
                UInt32 to_max_digits = 0;
143
128
                UInt32 to_precision = 0;
144
128
                UInt32 to_scale = 0;
145
146
128
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
128
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
128
                    const auto* to_decimal_type =
150
128
                            check_and_get_data_type<ToDataType>(to_type.get());
151
128
                    to_precision = to_decimal_type->get_precision();
152
128
                    ToDataType::check_type_precision(to_precision);
153
154
128
                    to_scale = to_decimal_type->get_scale();
155
128
                    ToDataType::check_type_scale(to_scale);
156
128
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
128
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
128
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
128
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
128
                if (to_scale > from_scale) {
167
62
                    multiply_may_overflow &=
168
62
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
62
                }
170
128
                return narrow_integral || multiply_may_overflow;
171
128
            }
172
0
            return false;
173
128
        });
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
285
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
285
            using Types2 = std::decay_t<decltype(types2)>;
122
285
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
285
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
285
                using FromFieldType = typename FromDataType::FieldType;
130
285
                using ToFieldType = typename ToDataType::FieldType;
131
285
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
285
                UInt32 from_scale = 0;
133
134
285
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
285
                    const auto* from_decimal_type =
136
285
                            check_and_get_data_type<FromDataType>(from_type.get());
137
285
                    from_precision =
138
285
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
285
                    from_scale = from_decimal_type->get_scale();
140
285
                }
141
142
285
                UInt32 to_max_digits = 0;
143
285
                UInt32 to_precision = 0;
144
285
                UInt32 to_scale = 0;
145
146
285
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
285
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
285
                    const auto* to_decimal_type =
150
285
                            check_and_get_data_type<ToDataType>(to_type.get());
151
285
                    to_precision = to_decimal_type->get_precision();
152
285
                    ToDataType::check_type_precision(to_precision);
153
154
285
                    to_scale = to_decimal_type->get_scale();
155
285
                    ToDataType::check_type_scale(to_scale);
156
285
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
285
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
285
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
285
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
285
                if (to_scale > from_scale) {
167
78
                    multiply_may_overflow &=
168
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
78
                }
170
285
                return narrow_integral || multiply_may_overflow;
171
285
            }
172
0
            return false;
173
285
        });
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
161
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
161
            using Types2 = std::decay_t<decltype(types2)>;
122
161
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
161
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
161
                using FromFieldType = typename FromDataType::FieldType;
130
161
                using ToFieldType = typename ToDataType::FieldType;
131
161
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
161
                UInt32 from_scale = 0;
133
134
161
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
161
                    const auto* from_decimal_type =
136
161
                            check_and_get_data_type<FromDataType>(from_type.get());
137
161
                    from_precision =
138
161
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
161
                    from_scale = from_decimal_type->get_scale();
140
161
                }
141
142
161
                UInt32 to_max_digits = 0;
143
161
                UInt32 to_precision = 0;
144
161
                UInt32 to_scale = 0;
145
146
161
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
161
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
161
                    const auto* to_decimal_type =
150
161
                            check_and_get_data_type<ToDataType>(to_type.get());
151
161
                    to_precision = to_decimal_type->get_precision();
152
161
                    ToDataType::check_type_precision(to_precision);
153
154
161
                    to_scale = to_decimal_type->get_scale();
155
161
                    ToDataType::check_type_scale(to_scale);
156
161
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
161
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
161
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
161
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
161
                if (to_scale > from_scale) {
167
0
                    multiply_may_overflow &=
168
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
0
                }
170
161
                return narrow_integral || multiply_may_overflow;
171
161
            }
172
0
            return false;
173
161
        });
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
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
296
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
296
                using FromFieldType = typename FromDataType::FieldType;
130
296
                using ToFieldType = typename ToDataType::FieldType;
131
296
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
296
                UInt32 from_scale = 0;
133
134
296
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
296
                    const auto* from_decimal_type =
136
296
                            check_and_get_data_type<FromDataType>(from_type.get());
137
296
                    from_precision =
138
296
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
296
                    from_scale = from_decimal_type->get_scale();
140
296
                }
141
142
296
                UInt32 to_max_digits = 0;
143
296
                UInt32 to_precision = 0;
144
296
                UInt32 to_scale = 0;
145
146
296
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
296
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
296
                    const auto* to_decimal_type =
150
296
                            check_and_get_data_type<ToDataType>(to_type.get());
151
296
                    to_precision = to_decimal_type->get_precision();
152
296
                    ToDataType::check_type_precision(to_precision);
153
154
296
                    to_scale = to_decimal_type->get_scale();
155
296
                    ToDataType::check_type_scale(to_scale);
156
296
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
296
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
296
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
296
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
296
                if (to_scale > from_scale) {
167
78
                    multiply_may_overflow &=
168
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
78
                }
170
296
                return narrow_integral || multiply_may_overflow;
171
296
            }
172
0
            return false;
173
296
        });
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
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
296
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
296
                using FromFieldType = typename FromDataType::FieldType;
130
296
                using ToFieldType = typename ToDataType::FieldType;
131
296
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
296
                UInt32 from_scale = 0;
133
134
296
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
296
                    const auto* from_decimal_type =
136
296
                            check_and_get_data_type<FromDataType>(from_type.get());
137
296
                    from_precision =
138
296
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
296
                    from_scale = from_decimal_type->get_scale();
140
296
                }
141
142
296
                UInt32 to_max_digits = 0;
143
296
                UInt32 to_precision = 0;
144
296
                UInt32 to_scale = 0;
145
146
296
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
296
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
296
                    const auto* to_decimal_type =
150
296
                            check_and_get_data_type<ToDataType>(to_type.get());
151
296
                    to_precision = to_decimal_type->get_precision();
152
296
                    ToDataType::check_type_precision(to_precision);
153
154
296
                    to_scale = to_decimal_type->get_scale();
155
296
                    ToDataType::check_type_scale(to_scale);
156
296
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
296
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
296
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
296
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
296
                if (to_scale > from_scale) {
167
78
                    multiply_may_overflow &=
168
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
78
                }
170
296
                return narrow_integral || multiply_may_overflow;
171
296
            }
172
0
            return false;
173
296
        });
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
1.63k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.63k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.63k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
1.63k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
1.63k
                return false;
127
1.63k
            }
128
1.63k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.63k
                using FromFieldType = typename FromDataType::FieldType;
130
1.63k
                using ToFieldType = typename ToDataType::FieldType;
131
1.63k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.63k
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_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.63k
                UInt32 to_max_digits = 0;
143
1.63k
                UInt32 to_precision = 0;
144
1.63k
                UInt32 to_scale = 0;
145
146
1.63k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.63k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.63k
                    const auto* to_decimal_type =
150
1.63k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.63k
                    to_precision = to_decimal_type->get_precision();
152
1.63k
                    ToDataType::check_type_precision(to_precision);
153
154
1.63k
                    to_scale = to_decimal_type->get_scale();
155
1.63k
                    ToDataType::check_type_scale(to_scale);
156
1.63k
                }
157
                if constexpr (IsIntegralV<ToFieldType> || 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.63k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.63k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.63k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.63k
                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.63k
                return narrow_integral || multiply_may_overflow;
171
1.63k
            }
172
0
            return false;
173
1.63k
        });
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
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_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
29
            using Types2 = std::decay_t<decltype(types2)>;
122
29
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
29
                using FromFieldType = typename FromDataType::FieldType;
130
29
                using ToFieldType = typename ToDataType::FieldType;
131
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
29
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
29
                UInt32 to_max_digits = 0;
143
29
                UInt32 to_precision = 0;
144
29
                UInt32 to_scale = 0;
145
146
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
29
                    const auto* to_decimal_type =
150
29
                            check_and_get_data_type<ToDataType>(to_type.get());
151
29
                    to_precision = to_decimal_type->get_precision();
152
29
                    ToDataType::check_type_precision(to_precision);
153
154
29
                    to_scale = to_decimal_type->get_scale();
155
29
                    ToDataType::check_type_scale(to_scale);
156
29
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
29
                if (to_scale > from_scale) {
167
18
                    multiply_may_overflow &=
168
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
18
                }
170
29
                return narrow_integral || multiply_may_overflow;
171
29
            }
172
0
            return false;
173
29
        });
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
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
29
            using Types2 = std::decay_t<decltype(types2)>;
122
29
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
29
                using FromFieldType = typename FromDataType::FieldType;
130
29
                using ToFieldType = typename ToDataType::FieldType;
131
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
29
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
29
                UInt32 to_max_digits = 0;
143
29
                UInt32 to_precision = 0;
144
29
                UInt32 to_scale = 0;
145
146
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
29
                    const auto* to_decimal_type =
150
29
                            check_and_get_data_type<ToDataType>(to_type.get());
151
29
                    to_precision = to_decimal_type->get_precision();
152
29
                    ToDataType::check_type_precision(to_precision);
153
154
29
                    to_scale = to_decimal_type->get_scale();
155
29
                    ToDataType::check_type_scale(to_scale);
156
29
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
29
                if (to_scale > from_scale) {
167
18
                    multiply_may_overflow &=
168
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
18
                }
170
29
                return narrow_integral || multiply_may_overflow;
171
29
            }
172
0
            return false;
173
29
        });
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
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
44
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
44
                using FromFieldType = typename FromDataType::FieldType;
130
44
                using ToFieldType = typename ToDataType::FieldType;
131
44
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
44
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
44
                UInt32 to_max_digits = 0;
143
44
                UInt32 to_precision = 0;
144
44
                UInt32 to_scale = 0;
145
146
44
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
44
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
44
                    const auto* to_decimal_type =
150
44
                            check_and_get_data_type<ToDataType>(to_type.get());
151
44
                    to_precision = to_decimal_type->get_precision();
152
44
                    ToDataType::check_type_precision(to_precision);
153
154
44
                    to_scale = to_decimal_type->get_scale();
155
44
                    ToDataType::check_type_scale(to_scale);
156
44
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
44
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
44
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
44
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
44
                if (to_scale > from_scale) {
167
28
                    multiply_may_overflow &=
168
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
28
                }
170
44
                return narrow_integral || multiply_may_overflow;
171
44
            }
172
0
            return false;
173
44
        });
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
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
28
                    multiply_may_overflow &=
168
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
28
                }
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_7EEESE_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
28
                    multiply_may_overflow &=
168
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
28
                }
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_8EEESE_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
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
99
                UInt32 to_max_digits = 0;
143
99
                UInt32 to_precision = 0;
144
99
                UInt32 to_scale = 0;
145
146
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
99
                    const auto* to_decimal_type =
150
99
                            check_and_get_data_type<ToDataType>(to_type.get());
151
99
                    to_precision = to_decimal_type->get_precision();
152
99
                    ToDataType::check_type_precision(to_precision);
153
154
99
                    to_scale = to_decimal_type->get_scale();
155
99
                    ToDataType::check_type_scale(to_scale);
156
99
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
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
58
                    multiply_may_overflow &=
168
58
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
58
                }
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_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_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
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
99
                UInt32 to_max_digits = 0;
143
99
                UInt32 to_precision = 0;
144
99
                UInt32 to_scale = 0;
145
146
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
99
                    const auto* to_decimal_type =
150
99
                            check_and_get_data_type<ToDataType>(to_type.get());
151
99
                    to_precision = to_decimal_type->get_precision();
152
99
                    ToDataType::check_type_precision(to_precision);
153
154
99
                    to_scale = to_decimal_type->get_scale();
155
99
                    ToDataType::check_type_scale(to_scale);
156
99
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
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
66
                    multiply_may_overflow &=
168
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
66
                }
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_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
120
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
168
            using Types2 = std::decay_t<decltype(types2)>;
122
168
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
168
                using FromFieldType = typename FromDataType::FieldType;
130
168
                using ToFieldType = typename ToDataType::FieldType;
131
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
168
                UInt32 from_scale = 0;
133
134
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
168
                    const auto* from_decimal_type =
136
168
                            check_and_get_data_type<FromDataType>(from_type.get());
137
168
                    from_precision =
138
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
168
                    from_scale = from_decimal_type->get_scale();
140
168
                }
141
142
168
                UInt32 to_max_digits = 0;
143
168
                UInt32 to_precision = 0;
144
168
                UInt32 to_scale = 0;
145
146
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
168
                    const auto* to_decimal_type =
150
168
                            check_and_get_data_type<ToDataType>(to_type.get());
151
168
                    to_precision = to_decimal_type->get_precision();
152
168
                    ToDataType::check_type_precision(to_precision);
153
154
168
                    to_scale = to_decimal_type->get_scale();
155
168
                    ToDataType::check_type_scale(to_scale);
156
168
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
168
                if (to_scale > from_scale) {
167
105
                    multiply_may_overflow &=
168
105
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
105
                }
170
168
                return narrow_integral || multiply_may_overflow;
171
168
            }
172
0
            return false;
173
168
        });
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
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
272
            using Types2 = std::decay_t<decltype(types2)>;
122
272
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
272
                using FromFieldType = typename FromDataType::FieldType;
130
272
                using ToFieldType = typename ToDataType::FieldType;
131
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
272
                UInt32 from_scale = 0;
133
134
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
272
                    const auto* from_decimal_type =
136
272
                            check_and_get_data_type<FromDataType>(from_type.get());
137
272
                    from_precision =
138
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
272
                    from_scale = from_decimal_type->get_scale();
140
272
                }
141
142
272
                UInt32 to_max_digits = 0;
143
272
                UInt32 to_precision = 0;
144
272
                UInt32 to_scale = 0;
145
146
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
272
                    const auto* to_decimal_type =
150
272
                            check_and_get_data_type<ToDataType>(to_type.get());
151
272
                    to_precision = to_decimal_type->get_precision();
152
272
                    ToDataType::check_type_precision(to_precision);
153
154
272
                    to_scale = to_decimal_type->get_scale();
155
272
                    ToDataType::check_type_scale(to_scale);
156
272
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
272
                if (to_scale > from_scale) {
167
152
                    multiply_may_overflow &=
168
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
152
                }
170
272
                return narrow_integral || multiply_may_overflow;
171
272
            }
172
0
            return false;
173
272
        });
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
180
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
180
            using Types2 = std::decay_t<decltype(types2)>;
122
180
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
180
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
180
                using FromFieldType = typename FromDataType::FieldType;
130
180
                using ToFieldType = typename ToDataType::FieldType;
131
180
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
180
                UInt32 from_scale = 0;
133
134
180
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
180
                    const auto* from_decimal_type =
136
180
                            check_and_get_data_type<FromDataType>(from_type.get());
137
180
                    from_precision =
138
180
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
180
                    from_scale = from_decimal_type->get_scale();
140
180
                }
141
142
180
                UInt32 to_max_digits = 0;
143
180
                UInt32 to_precision = 0;
144
180
                UInt32 to_scale = 0;
145
146
180
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
180
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
180
                    const auto* to_decimal_type =
150
180
                            check_and_get_data_type<ToDataType>(to_type.get());
151
180
                    to_precision = to_decimal_type->get_precision();
152
180
                    ToDataType::check_type_precision(to_precision);
153
154
180
                    to_scale = to_decimal_type->get_scale();
155
180
                    ToDataType::check_type_scale(to_scale);
156
180
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
180
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
180
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
180
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
180
                if (to_scale > from_scale) {
167
50
                    multiply_may_overflow &=
168
50
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
50
                }
170
180
                return narrow_integral || multiply_may_overflow;
171
180
            }
172
0
            return false;
173
180
        });
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
381
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
381
            using Types2 = std::decay_t<decltype(types2)>;
122
381
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
381
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
381
                using FromFieldType = typename FromDataType::FieldType;
130
381
                using ToFieldType = typename ToDataType::FieldType;
131
381
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
381
                UInt32 from_scale = 0;
133
134
381
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
381
                    const auto* from_decimal_type =
136
381
                            check_and_get_data_type<FromDataType>(from_type.get());
137
381
                    from_precision =
138
381
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
381
                    from_scale = from_decimal_type->get_scale();
140
381
                }
141
142
381
                UInt32 to_max_digits = 0;
143
381
                UInt32 to_precision = 0;
144
381
                UInt32 to_scale = 0;
145
146
381
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
381
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
381
                    const auto* to_decimal_type =
150
381
                            check_and_get_data_type<ToDataType>(to_type.get());
151
381
                    to_precision = to_decimal_type->get_precision();
152
381
                    ToDataType::check_type_precision(to_precision);
153
154
381
                    to_scale = to_decimal_type->get_scale();
155
381
                    ToDataType::check_type_scale(to_scale);
156
381
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
381
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
381
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
381
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
381
                if (to_scale > from_scale) {
167
136
                    multiply_may_overflow &=
168
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
136
                }
170
381
                return narrow_integral || multiply_may_overflow;
171
381
            }
172
0
            return false;
173
381
        });
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
392
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
392
            using Types2 = std::decay_t<decltype(types2)>;
122
392
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
392
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
392
                using FromFieldType = typename FromDataType::FieldType;
130
392
                using ToFieldType = typename ToDataType::FieldType;
131
392
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
392
                UInt32 from_scale = 0;
133
134
392
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
392
                    const auto* from_decimal_type =
136
392
                            check_and_get_data_type<FromDataType>(from_type.get());
137
392
                    from_precision =
138
392
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
392
                    from_scale = from_decimal_type->get_scale();
140
392
                }
141
142
392
                UInt32 to_max_digits = 0;
143
392
                UInt32 to_precision = 0;
144
392
                UInt32 to_scale = 0;
145
146
392
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
392
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
392
                    const auto* to_decimal_type =
150
392
                            check_and_get_data_type<ToDataType>(to_type.get());
151
392
                    to_precision = to_decimal_type->get_precision();
152
392
                    ToDataType::check_type_precision(to_precision);
153
154
392
                    to_scale = to_decimal_type->get_scale();
155
392
                    ToDataType::check_type_scale(to_scale);
156
392
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
392
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
392
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
392
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
392
                if (to_scale > from_scale) {
167
136
                    multiply_may_overflow &=
168
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
136
                }
170
392
                return narrow_integral || multiply_may_overflow;
171
392
            }
172
0
            return false;
173
392
        });
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
1.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.41k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.41k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
1.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
1.41k
                return false;
127
1.41k
            }
128
1.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.41k
                using FromFieldType = typename FromDataType::FieldType;
130
1.41k
                using ToFieldType = typename ToDataType::FieldType;
131
1.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.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
1.41k
                UInt32 to_max_digits = 0;
143
1.41k
                UInt32 to_precision = 0;
144
1.41k
                UInt32 to_scale = 0;
145
146
1.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.41k
                    const auto* to_decimal_type =
150
1.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.41k
                    to_precision = to_decimal_type->get_precision();
152
1.41k
                    ToDataType::check_type_precision(to_precision);
153
154
1.41k
                    to_scale = to_decimal_type->get_scale();
155
1.41k
                    ToDataType::check_type_scale(to_scale);
156
1.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
1.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.41k
                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.41k
                return narrow_integral || multiply_may_overflow;
171
1.41k
            }
172
0
            return false;
173
1.41k
        });
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
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
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
4
                UInt32 to_max_digits = 0;
143
4
                UInt32 to_precision = 0;
144
4
                UInt32 to_scale = 0;
145
146
4
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
4
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
4
                    const auto* to_decimal_type =
150
4
                            check_and_get_data_type<ToDataType>(to_type.get());
151
4
                    to_precision = to_decimal_type->get_precision();
152
4
                    ToDataType::check_type_precision(to_precision);
153
154
4
                    to_scale = to_decimal_type->get_scale();
155
4
                    ToDataType::check_type_scale(to_scale);
156
4
                }
157
                if constexpr (IsIntegralV<ToFieldType> || 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
4
                    multiply_may_overflow &=
168
4
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
4
                }
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_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_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_4EEESE_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_5EEESE_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_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_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_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_9EEESE_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_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_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
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
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_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
120
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
29
            using Types2 = std::decay_t<decltype(types2)>;
122
29
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
29
                using FromFieldType = typename FromDataType::FieldType;
130
29
                using ToFieldType = typename ToDataType::FieldType;
131
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
29
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
29
                UInt32 to_max_digits = 0;
143
29
                UInt32 to_precision = 0;
144
29
                UInt32 to_scale = 0;
145
146
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
29
                    const auto* to_decimal_type =
150
29
                            check_and_get_data_type<ToDataType>(to_type.get());
151
29
                    to_precision = to_decimal_type->get_precision();
152
29
                    ToDataType::check_type_precision(to_precision);
153
154
29
                    to_scale = to_decimal_type->get_scale();
155
29
                    ToDataType::check_type_scale(to_scale);
156
29
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
29
                if (to_scale > from_scale) {
167
18
                    multiply_may_overflow &=
168
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
18
                }
170
29
                return narrow_integral || multiply_may_overflow;
171
29
            }
172
0
            return false;
173
29
        });
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
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
29
            using Types2 = std::decay_t<decltype(types2)>;
122
29
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
29
                using FromFieldType = typename FromDataType::FieldType;
130
29
                using ToFieldType = typename ToDataType::FieldType;
131
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
29
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
29
                UInt32 to_max_digits = 0;
143
29
                UInt32 to_precision = 0;
144
29
                UInt32 to_scale = 0;
145
146
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
29
                    const auto* to_decimal_type =
150
29
                            check_and_get_data_type<ToDataType>(to_type.get());
151
29
                    to_precision = to_decimal_type->get_precision();
152
29
                    ToDataType::check_type_precision(to_precision);
153
154
29
                    to_scale = to_decimal_type->get_scale();
155
29
                    ToDataType::check_type_scale(to_scale);
156
29
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
29
                if (to_scale > from_scale) {
167
18
                    multiply_may_overflow &=
168
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
18
                }
170
29
                return narrow_integral || multiply_may_overflow;
171
29
            }
172
0
            return false;
173
29
        });
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
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
29
            using Types2 = std::decay_t<decltype(types2)>;
122
29
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
29
                using FromFieldType = typename FromDataType::FieldType;
130
29
                using ToFieldType = typename ToDataType::FieldType;
131
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
29
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
29
                UInt32 to_max_digits = 0;
143
29
                UInt32 to_precision = 0;
144
29
                UInt32 to_scale = 0;
145
146
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
29
                    const auto* to_decimal_type =
150
29
                            check_and_get_data_type<ToDataType>(to_type.get());
151
29
                    to_precision = to_decimal_type->get_precision();
152
29
                    ToDataType::check_type_precision(to_precision);
153
154
29
                    to_scale = to_decimal_type->get_scale();
155
29
                    ToDataType::check_type_scale(to_scale);
156
29
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
29
                if (to_scale > from_scale) {
167
18
                    multiply_may_overflow &=
168
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
18
                }
170
29
                return narrow_integral || multiply_may_overflow;
171
29
            }
172
0
            return false;
173
29
        });
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
34
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
34
            using Types2 = std::decay_t<decltype(types2)>;
122
34
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
34
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
34
                using FromFieldType = typename FromDataType::FieldType;
130
34
                using ToFieldType = typename ToDataType::FieldType;
131
34
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
34
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
34
                UInt32 to_max_digits = 0;
143
34
                UInt32 to_precision = 0;
144
34
                UInt32 to_scale = 0;
145
146
34
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
34
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
34
                    const auto* to_decimal_type =
150
34
                            check_and_get_data_type<ToDataType>(to_type.get());
151
34
                    to_precision = to_decimal_type->get_precision();
152
34
                    ToDataType::check_type_precision(to_precision);
153
154
34
                    to_scale = to_decimal_type->get_scale();
155
34
                    ToDataType::check_type_scale(to_scale);
156
34
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
34
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
34
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
34
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
34
                if (to_scale > from_scale) {
167
23
                    multiply_may_overflow &=
168
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
23
                }
170
34
                return narrow_integral || multiply_may_overflow;
171
34
            }
172
0
            return false;
173
34
        });
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
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
28
                    multiply_may_overflow &=
168
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
28
                }
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_13PrimitiveTypeE30EEEvEEEEbRKT_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
66
                    multiply_may_overflow &=
168
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
66
                }
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_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
120
91
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
91
            using Types2 = std::decay_t<decltype(types2)>;
122
91
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
91
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
91
                using FromFieldType = typename FromDataType::FieldType;
130
91
                using ToFieldType = typename ToDataType::FieldType;
131
91
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
91
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
91
                UInt32 to_max_digits = 0;
143
91
                UInt32 to_precision = 0;
144
91
                UInt32 to_scale = 0;
145
146
91
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
91
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
91
                    const auto* to_decimal_type =
150
91
                            check_and_get_data_type<ToDataType>(to_type.get());
151
91
                    to_precision = to_decimal_type->get_precision();
152
91
                    ToDataType::check_type_precision(to_precision);
153
154
91
                    to_scale = to_decimal_type->get_scale();
155
91
                    ToDataType::check_type_scale(to_scale);
156
91
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
91
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
91
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
91
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
91
                if (to_scale > from_scale) {
167
58
                    multiply_may_overflow &=
168
58
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
58
                }
170
91
                return narrow_integral || multiply_may_overflow;
171
91
            }
172
0
            return false;
173
91
        });
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
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
168
            using Types2 = std::decay_t<decltype(types2)>;
122
168
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
168
                using FromFieldType = typename FromDataType::FieldType;
130
168
                using ToFieldType = typename ToDataType::FieldType;
131
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
168
                UInt32 from_scale = 0;
133
134
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
168
                    const auto* from_decimal_type =
136
168
                            check_and_get_data_type<FromDataType>(from_type.get());
137
168
                    from_precision =
138
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
168
                    from_scale = from_decimal_type->get_scale();
140
168
                }
141
142
168
                UInt32 to_max_digits = 0;
143
168
                UInt32 to_precision = 0;
144
168
                UInt32 to_scale = 0;
145
146
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
168
                    const auto* to_decimal_type =
150
168
                            check_and_get_data_type<ToDataType>(to_type.get());
151
168
                    to_precision = to_decimal_type->get_precision();
152
168
                    ToDataType::check_type_precision(to_precision);
153
154
168
                    to_scale = to_decimal_type->get_scale();
155
168
                    ToDataType::check_type_scale(to_scale);
156
168
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
168
                if (to_scale > from_scale) {
167
106
                    multiply_may_overflow &=
168
106
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
106
                }
170
168
                return narrow_integral || multiply_may_overflow;
171
168
            }
172
0
            return false;
173
168
        });
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
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
264
            using Types2 = std::decay_t<decltype(types2)>;
122
264
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
264
                using FromFieldType = typename FromDataType::FieldType;
130
264
                using ToFieldType = typename ToDataType::FieldType;
131
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
264
                UInt32 from_scale = 0;
133
134
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
264
                    const auto* from_decimal_type =
136
264
                            check_and_get_data_type<FromDataType>(from_type.get());
137
264
                    from_precision =
138
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
264
                    from_scale = from_decimal_type->get_scale();
140
264
                }
141
142
264
                UInt32 to_max_digits = 0;
143
264
                UInt32 to_precision = 0;
144
264
                UInt32 to_scale = 0;
145
146
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
264
                    const auto* to_decimal_type =
150
264
                            check_and_get_data_type<ToDataType>(to_type.get());
151
264
                    to_precision = to_decimal_type->get_precision();
152
264
                    ToDataType::check_type_precision(to_precision);
153
154
264
                    to_scale = to_decimal_type->get_scale();
155
264
                    ToDataType::check_type_scale(to_scale);
156
264
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
264
                if (to_scale > from_scale) {
167
159
                    multiply_may_overflow &=
168
159
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
159
                }
170
264
                return narrow_integral || multiply_may_overflow;
171
264
            }
172
0
            return false;
173
264
        });
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
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
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
135
                using FromFieldType = typename FromDataType::FieldType;
130
135
                using ToFieldType = typename ToDataType::FieldType;
131
135
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
135
                UInt32 from_scale = 0;
133
134
135
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
135
                    const auto* from_decimal_type =
136
135
                            check_and_get_data_type<FromDataType>(from_type.get());
137
135
                    from_precision =
138
135
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
135
                    from_scale = from_decimal_type->get_scale();
140
135
                }
141
142
135
                UInt32 to_max_digits = 0;
143
135
                UInt32 to_precision = 0;
144
135
                UInt32 to_scale = 0;
145
146
135
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
135
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
135
                    const auto* to_decimal_type =
150
135
                            check_and_get_data_type<ToDataType>(to_type.get());
151
135
                    to_precision = to_decimal_type->get_precision();
152
135
                    ToDataType::check_type_precision(to_precision);
153
154
135
                    to_scale = to_decimal_type->get_scale();
155
135
                    ToDataType::check_type_scale(to_scale);
156
135
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
135
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
135
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
135
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
135
                if (to_scale > from_scale) {
167
68
                    multiply_may_overflow &=
168
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
68
                }
170
135
                return narrow_integral || multiply_may_overflow;
171
135
            }
172
0
            return false;
173
135
        });
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
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
272
            using Types2 = std::decay_t<decltype(types2)>;
122
272
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
272
                using FromFieldType = typename FromDataType::FieldType;
130
272
                using ToFieldType = typename ToDataType::FieldType;
131
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
272
                UInt32 from_scale = 0;
133
134
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
272
                    const auto* from_decimal_type =
136
272
                            check_and_get_data_type<FromDataType>(from_type.get());
137
272
                    from_precision =
138
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
272
                    from_scale = from_decimal_type->get_scale();
140
272
                }
141
142
272
                UInt32 to_max_digits = 0;
143
272
                UInt32 to_precision = 0;
144
272
                UInt32 to_scale = 0;
145
146
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
272
                    const auto* to_decimal_type =
150
272
                            check_and_get_data_type<ToDataType>(to_type.get());
151
272
                    to_precision = to_decimal_type->get_precision();
152
272
                    ToDataType::check_type_precision(to_precision);
153
154
272
                    to_scale = to_decimal_type->get_scale();
155
272
                    ToDataType::check_type_scale(to_scale);
156
272
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
272
                if (to_scale > from_scale) {
167
152
                    multiply_may_overflow &=
168
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
152
                }
170
272
                return narrow_integral || multiply_may_overflow;
171
272
            }
172
0
            return false;
173
272
        });
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
381
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
381
            using Types2 = std::decay_t<decltype(types2)>;
122
381
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
381
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
381
                using FromFieldType = typename FromDataType::FieldType;
130
381
                using ToFieldType = typename ToDataType::FieldType;
131
381
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
381
                UInt32 from_scale = 0;
133
134
381
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
381
                    const auto* from_decimal_type =
136
381
                            check_and_get_data_type<FromDataType>(from_type.get());
137
381
                    from_precision =
138
381
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
381
                    from_scale = from_decimal_type->get_scale();
140
381
                }
141
142
381
                UInt32 to_max_digits = 0;
143
381
                UInt32 to_precision = 0;
144
381
                UInt32 to_scale = 0;
145
146
381
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
381
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
381
                    const auto* to_decimal_type =
150
381
                            check_and_get_data_type<ToDataType>(to_type.get());
151
381
                    to_precision = to_decimal_type->get_precision();
152
381
                    ToDataType::check_type_precision(to_precision);
153
154
381
                    to_scale = to_decimal_type->get_scale();
155
381
                    ToDataType::check_type_scale(to_scale);
156
381
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
381
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
381
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
381
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
381
                if (to_scale > from_scale) {
167
136
                    multiply_may_overflow &=
168
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
136
                }
170
381
                return narrow_integral || multiply_may_overflow;
171
381
            }
172
0
            return false;
173
381
        });
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
1.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.41k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.41k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
1.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
1.41k
                return false;
127
1.41k
            }
128
1.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.41k
                using FromFieldType = typename FromDataType::FieldType;
130
1.41k
                using ToFieldType = typename ToDataType::FieldType;
131
1.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.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
1.41k
                UInt32 to_max_digits = 0;
143
1.41k
                UInt32 to_precision = 0;
144
1.41k
                UInt32 to_scale = 0;
145
146
1.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.41k
                    const auto* to_decimal_type =
150
1.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.41k
                    to_precision = to_decimal_type->get_precision();
152
1.41k
                    ToDataType::check_type_precision(to_precision);
153
154
1.41k
                    to_scale = to_decimal_type->get_scale();
155
1.41k
                    ToDataType::check_type_scale(to_scale);
156
1.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
1.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.41k
                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.41k
                return narrow_integral || multiply_may_overflow;
171
1.41k
            }
172
0
            return false;
173
1.41k
        });
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
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
29
            using Types2 = std::decay_t<decltype(types2)>;
122
29
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
29
                using FromFieldType = typename FromDataType::FieldType;
130
29
                using ToFieldType = typename ToDataType::FieldType;
131
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
29
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
29
                UInt32 to_max_digits = 0;
143
29
                UInt32 to_precision = 0;
144
29
                UInt32 to_scale = 0;
145
146
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
29
                    const auto* to_decimal_type =
150
29
                            check_and_get_data_type<ToDataType>(to_type.get());
151
29
                    to_precision = to_decimal_type->get_precision();
152
29
                    ToDataType::check_type_precision(to_precision);
153
154
29
                    to_scale = to_decimal_type->get_scale();
155
29
                    ToDataType::check_type_scale(to_scale);
156
29
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
29
                if (to_scale > from_scale) {
167
18
                    multiply_may_overflow &=
168
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
18
                }
170
29
                return narrow_integral || multiply_may_overflow;
171
29
            }
172
0
            return false;
173
29
        });
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
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
29
            using Types2 = std::decay_t<decltype(types2)>;
122
29
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
29
                using FromFieldType = typename FromDataType::FieldType;
130
29
                using ToFieldType = typename ToDataType::FieldType;
131
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
29
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
29
                UInt32 to_max_digits = 0;
143
29
                UInt32 to_precision = 0;
144
29
                UInt32 to_scale = 0;
145
146
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
29
                    const auto* to_decimal_type =
150
29
                            check_and_get_data_type<ToDataType>(to_type.get());
151
29
                    to_precision = to_decimal_type->get_precision();
152
29
                    ToDataType::check_type_precision(to_precision);
153
154
29
                    to_scale = to_decimal_type->get_scale();
155
29
                    ToDataType::check_type_scale(to_scale);
156
29
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
29
                if (to_scale > from_scale) {
167
18
                    multiply_may_overflow &=
168
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
18
                }
170
29
                return narrow_integral || multiply_may_overflow;
171
29
            }
172
0
            return false;
173
29
        });
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
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
29
            using Types2 = std::decay_t<decltype(types2)>;
122
29
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
29
                using FromFieldType = typename FromDataType::FieldType;
130
29
                using ToFieldType = typename ToDataType::FieldType;
131
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
29
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
29
                UInt32 to_max_digits = 0;
143
29
                UInt32 to_precision = 0;
144
29
                UInt32 to_scale = 0;
145
146
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
29
                    const auto* to_decimal_type =
150
29
                            check_and_get_data_type<ToDataType>(to_type.get());
151
29
                    to_precision = to_decimal_type->get_precision();
152
29
                    ToDataType::check_type_precision(to_precision);
153
154
29
                    to_scale = to_decimal_type->get_scale();
155
29
                    ToDataType::check_type_scale(to_scale);
156
29
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
29
                if (to_scale > from_scale) {
167
18
                    multiply_may_overflow &=
168
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
18
                }
170
29
                return narrow_integral || multiply_may_overflow;
171
29
            }
172
0
            return false;
173
29
        });
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
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
29
            using Types2 = std::decay_t<decltype(types2)>;
122
29
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
29
                using FromFieldType = typename FromDataType::FieldType;
130
29
                using ToFieldType = typename ToDataType::FieldType;
131
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
29
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
29
                UInt32 to_max_digits = 0;
143
29
                UInt32 to_precision = 0;
144
29
                UInt32 to_scale = 0;
145
146
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
29
                    const auto* to_decimal_type =
150
29
                            check_and_get_data_type<ToDataType>(to_type.get());
151
29
                    to_precision = to_decimal_type->get_precision();
152
29
                    ToDataType::check_type_precision(to_precision);
153
154
29
                    to_scale = to_decimal_type->get_scale();
155
29
                    ToDataType::check_type_scale(to_scale);
156
29
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
29
                if (to_scale > from_scale) {
167
18
                    multiply_may_overflow &=
168
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
18
                }
170
29
                return narrow_integral || multiply_may_overflow;
171
29
            }
172
0
            return false;
173
29
        });
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
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
44
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
44
                using FromFieldType = typename FromDataType::FieldType;
130
44
                using ToFieldType = typename ToDataType::FieldType;
131
44
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
44
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
44
                UInt32 to_max_digits = 0;
143
44
                UInt32 to_precision = 0;
144
44
                UInt32 to_scale = 0;
145
146
44
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
44
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
44
                    const auto* to_decimal_type =
150
44
                            check_and_get_data_type<ToDataType>(to_type.get());
151
44
                    to_precision = to_decimal_type->get_precision();
152
44
                    ToDataType::check_type_precision(to_precision);
153
154
44
                    to_scale = to_decimal_type->get_scale();
155
44
                    ToDataType::check_type_scale(to_scale);
156
44
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
44
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
44
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
44
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
44
                if (to_scale > from_scale) {
167
28
                    multiply_may_overflow &=
168
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
28
                }
170
44
                return narrow_integral || multiply_may_overflow;
171
44
            }
172
0
            return false;
173
44
        });
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
87
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
87
            using Types2 = std::decay_t<decltype(types2)>;
122
87
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
87
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
87
                using FromFieldType = typename FromDataType::FieldType;
130
87
                using ToFieldType = typename ToDataType::FieldType;
131
87
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
87
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
87
                UInt32 to_max_digits = 0;
143
87
                UInt32 to_precision = 0;
144
87
                UInt32 to_scale = 0;
145
146
87
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
87
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
87
                    const auto* to_decimal_type =
150
87
                            check_and_get_data_type<ToDataType>(to_type.get());
151
87
                    to_precision = to_decimal_type->get_precision();
152
87
                    ToDataType::check_type_precision(to_precision);
153
154
87
                    to_scale = to_decimal_type->get_scale();
155
87
                    ToDataType::check_type_scale(to_scale);
156
87
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
87
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
87
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
87
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
87
                if (to_scale > from_scale) {
167
66
                    multiply_may_overflow &=
168
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
66
                }
170
87
                return narrow_integral || multiply_may_overflow;
171
87
            }
172
0
            return false;
173
87
        });
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
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
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_type.get());
137
                    from_precision =
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
                    from_scale = from_decimal_type->get_scale();
140
                }
141
142
99
                UInt32 to_max_digits = 0;
143
99
                UInt32 to_precision = 0;
144
99
                UInt32 to_scale = 0;
145
146
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
99
                    const auto* to_decimal_type =
150
99
                            check_and_get_data_type<ToDataType>(to_type.get());
151
99
                    to_precision = to_decimal_type->get_precision();
152
99
                    ToDataType::check_type_precision(to_precision);
153
154
99
                    to_scale = to_decimal_type->get_scale();
155
99
                    ToDataType::check_type_scale(to_scale);
156
99
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
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
66
                    multiply_may_overflow &=
168
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
66
                }
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_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
120
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
168
            using Types2 = std::decay_t<decltype(types2)>;
122
168
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
168
                using FromFieldType = typename FromDataType::FieldType;
130
168
                using ToFieldType = typename ToDataType::FieldType;
131
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
168
                UInt32 from_scale = 0;
133
134
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
168
                    const auto* from_decimal_type =
136
168
                            check_and_get_data_type<FromDataType>(from_type.get());
137
168
                    from_precision =
138
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
168
                    from_scale = from_decimal_type->get_scale();
140
168
                }
141
142
168
                UInt32 to_max_digits = 0;
143
168
                UInt32 to_precision = 0;
144
168
                UInt32 to_scale = 0;
145
146
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
168
                    const auto* to_decimal_type =
150
168
                            check_and_get_data_type<ToDataType>(to_type.get());
151
168
                    to_precision = to_decimal_type->get_precision();
152
168
                    ToDataType::check_type_precision(to_precision);
153
154
168
                    to_scale = to_decimal_type->get_scale();
155
168
                    ToDataType::check_type_scale(to_scale);
156
168
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
168
                if (to_scale > from_scale) {
167
106
                    multiply_may_overflow &=
168
106
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
106
                }
170
168
                return narrow_integral || multiply_may_overflow;
171
168
            }
172
0
            return false;
173
168
        });
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
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
264
            using Types2 = std::decay_t<decltype(types2)>;
122
264
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
264
                using FromFieldType = typename FromDataType::FieldType;
130
264
                using ToFieldType = typename ToDataType::FieldType;
131
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
264
                UInt32 from_scale = 0;
133
134
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
264
                    const auto* from_decimal_type =
136
264
                            check_and_get_data_type<FromDataType>(from_type.get());
137
264
                    from_precision =
138
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
264
                    from_scale = from_decimal_type->get_scale();
140
264
                }
141
142
264
                UInt32 to_max_digits = 0;
143
264
                UInt32 to_precision = 0;
144
264
                UInt32 to_scale = 0;
145
146
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
264
                    const auto* to_decimal_type =
150
264
                            check_and_get_data_type<ToDataType>(to_type.get());
151
264
                    to_precision = to_decimal_type->get_precision();
152
264
                    ToDataType::check_type_precision(to_precision);
153
154
264
                    to_scale = to_decimal_type->get_scale();
155
264
                    ToDataType::check_type_scale(to_scale);
156
264
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
264
                if (to_scale > from_scale) {
167
160
                    multiply_may_overflow &=
168
160
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
160
                }
170
264
                return narrow_integral || multiply_may_overflow;
171
264
            }
172
0
            return false;
173
264
        });
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
132
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
132
            using Types2 = std::decay_t<decltype(types2)>;
122
132
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
132
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
132
                using FromFieldType = typename FromDataType::FieldType;
130
132
                using ToFieldType = typename ToDataType::FieldType;
131
132
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
132
                UInt32 from_scale = 0;
133
134
132
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
132
                    const auto* from_decimal_type =
136
132
                            check_and_get_data_type<FromDataType>(from_type.get());
137
132
                    from_precision =
138
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
132
                    from_scale = from_decimal_type->get_scale();
140
132
                }
141
142
132
                UInt32 to_max_digits = 0;
143
132
                UInt32 to_precision = 0;
144
132
                UInt32 to_scale = 0;
145
146
132
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
132
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
132
                    const auto* to_decimal_type =
150
132
                            check_and_get_data_type<ToDataType>(to_type.get());
151
132
                    to_precision = to_decimal_type->get_precision();
152
132
                    ToDataType::check_type_precision(to_precision);
153
154
132
                    to_scale = to_decimal_type->get_scale();
155
132
                    ToDataType::check_type_scale(to_scale);
156
132
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
132
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
132
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
132
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
132
                if (to_scale > from_scale) {
167
68
                    multiply_may_overflow &=
168
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
68
                }
170
132
                return narrow_integral || multiply_may_overflow;
171
132
            }
172
0
            return false;
173
132
        });
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
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
264
            using Types2 = std::decay_t<decltype(types2)>;
122
264
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
264
                using FromFieldType = typename FromDataType::FieldType;
130
264
                using ToFieldType = typename ToDataType::FieldType;
131
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
264
                UInt32 from_scale = 0;
133
134
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
264
                    const auto* from_decimal_type =
136
264
                            check_and_get_data_type<FromDataType>(from_type.get());
137
264
                    from_precision =
138
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
264
                    from_scale = from_decimal_type->get_scale();
140
264
                }
141
142
264
                UInt32 to_max_digits = 0;
143
264
                UInt32 to_precision = 0;
144
264
                UInt32 to_scale = 0;
145
146
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
264
                    const auto* to_decimal_type =
150
264
                            check_and_get_data_type<ToDataType>(to_type.get());
151
264
                    to_precision = to_decimal_type->get_precision();
152
264
                    ToDataType::check_type_precision(to_precision);
153
154
264
                    to_scale = to_decimal_type->get_scale();
155
264
                    ToDataType::check_type_scale(to_scale);
156
264
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
264
                if (to_scale > from_scale) {
167
159
                    multiply_may_overflow &=
168
159
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
159
                }
170
264
                return narrow_integral || multiply_may_overflow;
171
264
            }
172
0
            return false;
173
264
        });
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
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
272
            using Types2 = std::decay_t<decltype(types2)>;
122
272
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
                return false;
127
            }
128
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
272
                using FromFieldType = typename FromDataType::FieldType;
130
272
                using ToFieldType = typename ToDataType::FieldType;
131
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
272
                UInt32 from_scale = 0;
133
134
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
272
                    const auto* from_decimal_type =
136
272
                            check_and_get_data_type<FromDataType>(from_type.get());
137
272
                    from_precision =
138
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
272
                    from_scale = from_decimal_type->get_scale();
140
272
                }
141
142
272
                UInt32 to_max_digits = 0;
143
272
                UInt32 to_precision = 0;
144
272
                UInt32 to_scale = 0;
145
146
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
272
                    const auto* to_decimal_type =
150
272
                            check_and_get_data_type<ToDataType>(to_type.get());
151
272
                    to_precision = to_decimal_type->get_precision();
152
272
                    ToDataType::check_type_precision(to_precision);
153
154
272
                    to_scale = to_decimal_type->get_scale();
155
272
                    ToDataType::check_type_scale(to_scale);
156
272
                }
157
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
                    to_precision = to_max_digits;
160
                }
161
162
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
272
                if (to_scale > from_scale) {
167
152
                    multiply_may_overflow &=
168
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
152
                }
170
272
                return narrow_integral || multiply_may_overflow;
171
272
            }
172
0
            return false;
173
272
        });
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
1.39k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.39k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.39k
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
1.39k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
1.39k
                return false;
127
1.39k
            }
128
1.39k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.39k
                using FromFieldType = typename FromDataType::FieldType;
130
1.39k
                using ToFieldType = typename ToDataType::FieldType;
131
1.39k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.39k
                UInt32 from_scale = 0;
133
134
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
                    const auto* from_decimal_type =
136
                            check_and_get_data_type<FromDataType>(from_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.39k
                UInt32 to_max_digits = 0;
143
1.39k
                UInt32 to_precision = 0;
144
1.39k
                UInt32 to_scale = 0;
145
146
1.39k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.39k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.39k
                    const auto* to_decimal_type =
150
1.39k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.39k
                    to_precision = to_decimal_type->get_precision();
152
1.39k
                    ToDataType::check_type_precision(to_precision);
153
154
1.39k
                    to_scale = to_decimal_type->get_scale();
155
1.39k
                    ToDataType::check_type_scale(to_scale);
156
1.39k
                }
157
                if constexpr (IsIntegralV<ToFieldType> || 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.39k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.39k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.39k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.39k
                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.39k
                return narrow_integral || multiply_may_overflow;
171
1.39k
            }
172
0
            return false;
173
1.39k
        });
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_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
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_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
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_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
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_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
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
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_16DataTypeDateTimeESC_EEEEbSG_
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
51
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
51
            using Types2 = std::decay_t<decltype(types2)>;
122
51
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
51
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
51
                return false;
127
51
            }
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
51
            return false;
173
51
        });
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_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
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
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_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
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_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
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_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
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
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_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
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
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_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
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
50
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
50
            using Types2 = std::decay_t<decltype(types2)>;
122
50
            using FromDataType = typename Types2::LeftType;
123
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
50
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
50
                return false;
127
50
            }
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
50
            return false;
173
50
        });
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_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
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_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
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
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_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
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
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_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
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
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
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
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_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
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
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
12
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
12
                return false;
127
12
            }
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
        });
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
35.2k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
110
48
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
48
        using Types = std::decay_t<decltype(types)>;
112
48
        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
48
        return call_on_index_and_data_type<
120
48
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
48
            using Types2 = std::decay_t<decltype(types2)>;
122
48
            using FromDataType = typename Types2::LeftType;
123
48
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
48
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
48
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
48
                return false;
127
48
            }
128
48
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
48
                using FromFieldType = typename FromDataType::FieldType;
130
48
                using ToFieldType = typename ToDataType::FieldType;
131
48
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
48
                UInt32 from_scale = 0;
133
134
48
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
48
                    const auto* from_decimal_type =
136
48
                            check_and_get_data_type<FromDataType>(from_type.get());
137
48
                    from_precision =
138
48
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
48
                    from_scale = from_decimal_type->get_scale();
140
48
                }
141
142
48
                UInt32 to_max_digits = 0;
143
48
                UInt32 to_precision = 0;
144
48
                UInt32 to_scale = 0;
145
146
48
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
48
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
48
                    const auto* to_decimal_type =
150
48
                            check_and_get_data_type<ToDataType>(to_type.get());
151
48
                    to_precision = to_decimal_type->get_precision();
152
48
                    ToDataType::check_type_precision(to_precision);
153
154
48
                    to_scale = to_decimal_type->get_scale();
155
48
                    ToDataType::check_type_scale(to_scale);
156
48
                }
157
48
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
48
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
48
                    to_precision = to_max_digits;
160
48
                }
161
162
48
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
48
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
48
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
48
                if (to_scale > from_scale) {
167
48
                    multiply_may_overflow &=
168
48
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
48
                }
170
48
                return narrow_integral || multiply_may_overflow;
171
48
            }
172
48
            return false;
173
48
        });
174
48
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
110
1.44k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
1.44k
        using Types = std::decay_t<decltype(types)>;
112
1.44k
        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
1.44k
        return call_on_index_and_data_type<
120
1.44k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.44k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.44k
            using FromDataType = typename Types2::LeftType;
123
1.44k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
1.44k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
1.44k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
1.44k
                return false;
127
1.44k
            }
128
1.44k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.44k
                using FromFieldType = typename FromDataType::FieldType;
130
1.44k
                using ToFieldType = typename ToDataType::FieldType;
131
1.44k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.44k
                UInt32 from_scale = 0;
133
134
1.44k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
1.44k
                    const auto* from_decimal_type =
136
1.44k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
1.44k
                    from_precision =
138
1.44k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
1.44k
                    from_scale = from_decimal_type->get_scale();
140
1.44k
                }
141
142
1.44k
                UInt32 to_max_digits = 0;
143
1.44k
                UInt32 to_precision = 0;
144
1.44k
                UInt32 to_scale = 0;
145
146
1.44k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.44k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.44k
                    const auto* to_decimal_type =
150
1.44k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.44k
                    to_precision = to_decimal_type->get_precision();
152
1.44k
                    ToDataType::check_type_precision(to_precision);
153
154
1.44k
                    to_scale = to_decimal_type->get_scale();
155
1.44k
                    ToDataType::check_type_scale(to_scale);
156
1.44k
                }
157
1.44k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
1.44k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
1.44k
                    to_precision = to_max_digits;
160
1.44k
                }
161
162
1.44k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.44k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.44k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.44k
                if (to_scale > from_scale) {
167
1.44k
                    multiply_may_overflow &=
168
1.44k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
1.44k
                }
170
1.44k
                return narrow_integral || multiply_may_overflow;
171
1.44k
            }
172
1.44k
            return false;
173
1.44k
        });
174
1.44k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
110
1.42k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
1.42k
        using Types = std::decay_t<decltype(types)>;
112
1.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
1.42k
        return call_on_index_and_data_type<
120
1.42k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.42k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.42k
            using FromDataType = typename Types2::LeftType;
123
1.42k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
1.42k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
1.42k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
1.42k
                return false;
127
1.42k
            }
128
1.42k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.42k
                using FromFieldType = typename FromDataType::FieldType;
130
1.42k
                using ToFieldType = typename ToDataType::FieldType;
131
1.42k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.42k
                UInt32 from_scale = 0;
133
134
1.42k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
1.42k
                    const auto* from_decimal_type =
136
1.42k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
1.42k
                    from_precision =
138
1.42k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
1.42k
                    from_scale = from_decimal_type->get_scale();
140
1.42k
                }
141
142
1.42k
                UInt32 to_max_digits = 0;
143
1.42k
                UInt32 to_precision = 0;
144
1.42k
                UInt32 to_scale = 0;
145
146
1.42k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.42k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.42k
                    const auto* to_decimal_type =
150
1.42k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.42k
                    to_precision = to_decimal_type->get_precision();
152
1.42k
                    ToDataType::check_type_precision(to_precision);
153
154
1.42k
                    to_scale = to_decimal_type->get_scale();
155
1.42k
                    ToDataType::check_type_scale(to_scale);
156
1.42k
                }
157
1.42k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
1.42k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
1.42k
                    to_precision = to_max_digits;
160
1.42k
                }
161
162
1.42k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.42k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.42k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.42k
                if (to_scale > from_scale) {
167
1.42k
                    multiply_may_overflow &=
168
1.42k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
1.42k
                }
170
1.42k
                return narrow_integral || multiply_may_overflow;
171
1.42k
            }
172
1.42k
            return false;
173
1.42k
        });
174
1.42k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
110
1.28k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
1.28k
        using Types = std::decay_t<decltype(types)>;
112
1.28k
        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
1.28k
        return call_on_index_and_data_type<
120
1.28k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.28k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.28k
            using FromDataType = typename Types2::LeftType;
123
1.28k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
1.28k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
1.28k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
1.28k
                return false;
127
1.28k
            }
128
1.28k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.28k
                using FromFieldType = typename FromDataType::FieldType;
130
1.28k
                using ToFieldType = typename ToDataType::FieldType;
131
1.28k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.28k
                UInt32 from_scale = 0;
133
134
1.28k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
1.28k
                    const auto* from_decimal_type =
136
1.28k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
1.28k
                    from_precision =
138
1.28k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
1.28k
                    from_scale = from_decimal_type->get_scale();
140
1.28k
                }
141
142
1.28k
                UInt32 to_max_digits = 0;
143
1.28k
                UInt32 to_precision = 0;
144
1.28k
                UInt32 to_scale = 0;
145
146
1.28k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.28k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.28k
                    const auto* to_decimal_type =
150
1.28k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.28k
                    to_precision = to_decimal_type->get_precision();
152
1.28k
                    ToDataType::check_type_precision(to_precision);
153
154
1.28k
                    to_scale = to_decimal_type->get_scale();
155
1.28k
                    ToDataType::check_type_scale(to_scale);
156
1.28k
                }
157
1.28k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
1.28k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
1.28k
                    to_precision = to_max_digits;
160
1.28k
                }
161
162
1.28k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.28k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.28k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.28k
                if (to_scale > from_scale) {
167
1.28k
                    multiply_may_overflow &=
168
1.28k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
1.28k
                }
170
1.28k
                return narrow_integral || multiply_may_overflow;
171
1.28k
            }
172
1.28k
            return false;
173
1.28k
        });
174
1.28k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
110
1.02k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
1.02k
        using Types = std::decay_t<decltype(types)>;
112
1.02k
        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
1.02k
        return call_on_index_and_data_type<
120
1.02k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.02k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.02k
            using FromDataType = typename Types2::LeftType;
123
1.02k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
1.02k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
1.02k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
1.02k
                return false;
127
1.02k
            }
128
1.02k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.02k
                using FromFieldType = typename FromDataType::FieldType;
130
1.02k
                using ToFieldType = typename ToDataType::FieldType;
131
1.02k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.02k
                UInt32 from_scale = 0;
133
134
1.02k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
1.02k
                    const auto* from_decimal_type =
136
1.02k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
1.02k
                    from_precision =
138
1.02k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
1.02k
                    from_scale = from_decimal_type->get_scale();
140
1.02k
                }
141
142
1.02k
                UInt32 to_max_digits = 0;
143
1.02k
                UInt32 to_precision = 0;
144
1.02k
                UInt32 to_scale = 0;
145
146
1.02k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.02k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.02k
                    const auto* to_decimal_type =
150
1.02k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.02k
                    to_precision = to_decimal_type->get_precision();
152
1.02k
                    ToDataType::check_type_precision(to_precision);
153
154
1.02k
                    to_scale = to_decimal_type->get_scale();
155
1.02k
                    ToDataType::check_type_scale(to_scale);
156
1.02k
                }
157
1.02k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
1.02k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
1.02k
                    to_precision = to_max_digits;
160
1.02k
                }
161
162
1.02k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.02k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.02k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.02k
                if (to_scale > from_scale) {
167
1.02k
                    multiply_may_overflow &=
168
1.02k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
1.02k
                }
170
1.02k
                return narrow_integral || multiply_may_overflow;
171
1.02k
            }
172
1.02k
            return false;
173
1.02k
        });
174
1.02k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
110
1.08k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
1.08k
        using Types = std::decay_t<decltype(types)>;
112
1.08k
        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
1.08k
        return call_on_index_and_data_type<
120
1.08k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
1.08k
            using Types2 = std::decay_t<decltype(types2)>;
122
1.08k
            using FromDataType = typename Types2::LeftType;
123
1.08k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
1.08k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
1.08k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
1.08k
                return false;
127
1.08k
            }
128
1.08k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
1.08k
                using FromFieldType = typename FromDataType::FieldType;
130
1.08k
                using ToFieldType = typename ToDataType::FieldType;
131
1.08k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
1.08k
                UInt32 from_scale = 0;
133
134
1.08k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
1.08k
                    const auto* from_decimal_type =
136
1.08k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
1.08k
                    from_precision =
138
1.08k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
1.08k
                    from_scale = from_decimal_type->get_scale();
140
1.08k
                }
141
142
1.08k
                UInt32 to_max_digits = 0;
143
1.08k
                UInt32 to_precision = 0;
144
1.08k
                UInt32 to_scale = 0;
145
146
1.08k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
1.08k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
1.08k
                    const auto* to_decimal_type =
150
1.08k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
1.08k
                    to_precision = to_decimal_type->get_precision();
152
1.08k
                    ToDataType::check_type_precision(to_precision);
153
154
1.08k
                    to_scale = to_decimal_type->get_scale();
155
1.08k
                    ToDataType::check_type_scale(to_scale);
156
1.08k
                }
157
1.08k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
1.08k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
1.08k
                    to_precision = to_max_digits;
160
1.08k
                }
161
162
1.08k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
1.08k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
1.08k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
1.08k
                if (to_scale > from_scale) {
167
1.08k
                    multiply_may_overflow &=
168
1.08k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
1.08k
                }
170
1.08k
                return narrow_integral || multiply_may_overflow;
171
1.08k
            }
172
1.08k
            return false;
173
1.08k
        });
174
1.08k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
110
8.17k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
8.17k
        using Types = std::decay_t<decltype(types)>;
112
8.17k
        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
8.17k
        return call_on_index_and_data_type<
120
8.17k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
8.17k
            using Types2 = std::decay_t<decltype(types2)>;
122
8.17k
            using FromDataType = typename Types2::LeftType;
123
8.17k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
8.17k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
8.17k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
8.17k
                return false;
127
8.17k
            }
128
8.17k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
8.17k
                using FromFieldType = typename FromDataType::FieldType;
130
8.17k
                using ToFieldType = typename ToDataType::FieldType;
131
8.17k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
8.17k
                UInt32 from_scale = 0;
133
134
8.17k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
8.17k
                    const auto* from_decimal_type =
136
8.17k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
8.17k
                    from_precision =
138
8.17k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
8.17k
                    from_scale = from_decimal_type->get_scale();
140
8.17k
                }
141
142
8.17k
                UInt32 to_max_digits = 0;
143
8.17k
                UInt32 to_precision = 0;
144
8.17k
                UInt32 to_scale = 0;
145
146
8.17k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
8.17k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
8.17k
                    const auto* to_decimal_type =
150
8.17k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
8.17k
                    to_precision = to_decimal_type->get_precision();
152
8.17k
                    ToDataType::check_type_precision(to_precision);
153
154
8.17k
                    to_scale = to_decimal_type->get_scale();
155
8.17k
                    ToDataType::check_type_scale(to_scale);
156
8.17k
                }
157
8.17k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
8.17k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
8.17k
                    to_precision = to_max_digits;
160
8.17k
                }
161
162
8.17k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
8.17k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
8.17k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
8.17k
                if (to_scale > from_scale) {
167
8.17k
                    multiply_may_overflow &=
168
8.17k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
8.17k
                }
170
8.17k
                return narrow_integral || multiply_may_overflow;
171
8.17k
            }
172
8.17k
            return false;
173
8.17k
        });
174
8.17k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
110
8.24k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
8.24k
        using Types = std::decay_t<decltype(types)>;
112
8.24k
        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
8.24k
        return call_on_index_and_data_type<
120
8.24k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
8.24k
            using Types2 = std::decay_t<decltype(types2)>;
122
8.24k
            using FromDataType = typename Types2::LeftType;
123
8.24k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
8.24k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
8.24k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
8.24k
                return false;
127
8.24k
            }
128
8.24k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
8.24k
                using FromFieldType = typename FromDataType::FieldType;
130
8.24k
                using ToFieldType = typename ToDataType::FieldType;
131
8.24k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
8.24k
                UInt32 from_scale = 0;
133
134
8.24k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
8.24k
                    const auto* from_decimal_type =
136
8.24k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
8.24k
                    from_precision =
138
8.24k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
8.24k
                    from_scale = from_decimal_type->get_scale();
140
8.24k
                }
141
142
8.24k
                UInt32 to_max_digits = 0;
143
8.24k
                UInt32 to_precision = 0;
144
8.24k
                UInt32 to_scale = 0;
145
146
8.24k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
8.24k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
8.24k
                    const auto* to_decimal_type =
150
8.24k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
8.24k
                    to_precision = to_decimal_type->get_precision();
152
8.24k
                    ToDataType::check_type_precision(to_precision);
153
154
8.24k
                    to_scale = to_decimal_type->get_scale();
155
8.24k
                    ToDataType::check_type_scale(to_scale);
156
8.24k
                }
157
8.24k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
8.24k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
8.24k
                    to_precision = to_max_digits;
160
8.24k
                }
161
162
8.24k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
8.24k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
8.24k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
8.24k
                if (to_scale > from_scale) {
167
8.24k
                    multiply_may_overflow &=
168
8.24k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
8.24k
                }
170
8.24k
                return narrow_integral || multiply_may_overflow;
171
8.24k
            }
172
8.24k
            return false;
173
8.24k
        });
174
8.24k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
110
3.23k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
3.23k
        using Types = std::decay_t<decltype(types)>;
112
3.23k
        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
3.23k
        return call_on_index_and_data_type<
120
3.23k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
3.23k
            using Types2 = std::decay_t<decltype(types2)>;
122
3.23k
            using FromDataType = typename Types2::LeftType;
123
3.23k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
3.23k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
3.23k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
3.23k
                return false;
127
3.23k
            }
128
3.23k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
3.23k
                using FromFieldType = typename FromDataType::FieldType;
130
3.23k
                using ToFieldType = typename ToDataType::FieldType;
131
3.23k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
3.23k
                UInt32 from_scale = 0;
133
134
3.23k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
3.23k
                    const auto* from_decimal_type =
136
3.23k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
3.23k
                    from_precision =
138
3.23k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
3.23k
                    from_scale = from_decimal_type->get_scale();
140
3.23k
                }
141
142
3.23k
                UInt32 to_max_digits = 0;
143
3.23k
                UInt32 to_precision = 0;
144
3.23k
                UInt32 to_scale = 0;
145
146
3.23k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
3.23k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
3.23k
                    const auto* to_decimal_type =
150
3.23k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
3.23k
                    to_precision = to_decimal_type->get_precision();
152
3.23k
                    ToDataType::check_type_precision(to_precision);
153
154
3.23k
                    to_scale = to_decimal_type->get_scale();
155
3.23k
                    ToDataType::check_type_scale(to_scale);
156
3.23k
                }
157
3.23k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
3.23k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
3.23k
                    to_precision = to_max_digits;
160
3.23k
                }
161
162
3.23k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
3.23k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
3.23k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
3.23k
                if (to_scale > from_scale) {
167
3.23k
                    multiply_may_overflow &=
168
3.23k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
3.23k
                }
170
3.23k
                return narrow_integral || multiply_may_overflow;
171
3.23k
            }
172
3.23k
            return false;
173
3.23k
        });
174
3.23k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
110
3.21k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
3.21k
        using Types = std::decay_t<decltype(types)>;
112
3.21k
        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
3.21k
        return call_on_index_and_data_type<
120
3.21k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
3.21k
            using Types2 = std::decay_t<decltype(types2)>;
122
3.21k
            using FromDataType = typename Types2::LeftType;
123
3.21k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
3.21k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
3.21k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
3.21k
                return false;
127
3.21k
            }
128
3.21k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
3.21k
                using FromFieldType = typename FromDataType::FieldType;
130
3.21k
                using ToFieldType = typename ToDataType::FieldType;
131
3.21k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
3.21k
                UInt32 from_scale = 0;
133
134
3.21k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
3.21k
                    const auto* from_decimal_type =
136
3.21k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
3.21k
                    from_precision =
138
3.21k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
3.21k
                    from_scale = from_decimal_type->get_scale();
140
3.21k
                }
141
142
3.21k
                UInt32 to_max_digits = 0;
143
3.21k
                UInt32 to_precision = 0;
144
3.21k
                UInt32 to_scale = 0;
145
146
3.21k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
3.21k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
3.21k
                    const auto* to_decimal_type =
150
3.21k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
3.21k
                    to_precision = to_decimal_type->get_precision();
152
3.21k
                    ToDataType::check_type_precision(to_precision);
153
154
3.21k
                    to_scale = to_decimal_type->get_scale();
155
3.21k
                    ToDataType::check_type_scale(to_scale);
156
3.21k
                }
157
3.21k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
3.21k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
3.21k
                    to_precision = to_max_digits;
160
3.21k
                }
161
162
3.21k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
3.21k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
3.21k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
3.21k
                if (to_scale > from_scale) {
167
3.21k
                    multiply_may_overflow &=
168
3.21k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
3.21k
                }
170
3.21k
                return narrow_integral || multiply_may_overflow;
171
3.21k
            }
172
3.21k
            return false;
173
3.21k
        });
174
3.21k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
110
4
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
4
        using Types = std::decay_t<decltype(types)>;
112
4
        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
        return call_on_index_and_data_type<
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
4
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
4
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
4
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
4
                return false;
127
4
            }
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
4
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
4
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
4
                    const auto* to_decimal_type =
150
4
                            check_and_get_data_type<ToDataType>(to_type.get());
151
4
                    to_precision = to_decimal_type->get_precision();
152
4
                    ToDataType::check_type_precision(to_precision);
153
154
4
                    to_scale = to_decimal_type->get_scale();
155
4
                    ToDataType::check_type_scale(to_scale);
156
4
                }
157
4
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
4
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
4
                    to_precision = to_max_digits;
160
4
                }
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
4
                    multiply_may_overflow &=
168
4
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
4
                }
170
4
                return narrow_integral || multiply_may_overflow;
171
4
            }
172
4
            return false;
173
4
        });
174
4
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
110
3.01k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
3.01k
        using Types = std::decay_t<decltype(types)>;
112
3.01k
        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
3.01k
        return call_on_index_and_data_type<
120
3.01k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
3.01k
            using Types2 = std::decay_t<decltype(types2)>;
122
3.01k
            using FromDataType = typename Types2::LeftType;
123
3.01k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
3.01k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
3.01k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
3.01k
                return false;
127
3.01k
            }
128
3.01k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
3.01k
                using FromFieldType = typename FromDataType::FieldType;
130
3.01k
                using ToFieldType = typename ToDataType::FieldType;
131
3.01k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
3.01k
                UInt32 from_scale = 0;
133
134
3.01k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
3.01k
                    const auto* from_decimal_type =
136
3.01k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
3.01k
                    from_precision =
138
3.01k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
3.01k
                    from_scale = from_decimal_type->get_scale();
140
3.01k
                }
141
142
3.01k
                UInt32 to_max_digits = 0;
143
3.01k
                UInt32 to_precision = 0;
144
3.01k
                UInt32 to_scale = 0;
145
146
3.01k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
3.01k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
3.01k
                    const auto* to_decimal_type =
150
3.01k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
3.01k
                    to_precision = to_decimal_type->get_precision();
152
3.01k
                    ToDataType::check_type_precision(to_precision);
153
154
3.01k
                    to_scale = to_decimal_type->get_scale();
155
3.01k
                    ToDataType::check_type_scale(to_scale);
156
3.01k
                }
157
3.01k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
3.01k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
3.01k
                    to_precision = to_max_digits;
160
3.01k
                }
161
162
3.01k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
3.01k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
3.01k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
3.01k
                if (to_scale > from_scale) {
167
3.01k
                    multiply_may_overflow &=
168
3.01k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
3.01k
                }
170
3.01k
                return narrow_integral || multiply_may_overflow;
171
3.01k
            }
172
3.01k
            return false;
173
3.01k
        });
174
3.01k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_
Line
Count
Source
110
2.84k
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
2.84k
        using Types = std::decay_t<decltype(types)>;
112
2.84k
        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.84k
        return call_on_index_and_data_type<
120
2.84k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
2.84k
            using Types2 = std::decay_t<decltype(types2)>;
122
2.84k
            using FromDataType = typename Types2::LeftType;
123
2.84k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
2.84k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
2.84k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
2.84k
                return false;
127
2.84k
            }
128
2.84k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
2.84k
                using FromFieldType = typename FromDataType::FieldType;
130
2.84k
                using ToFieldType = typename ToDataType::FieldType;
131
2.84k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
2.84k
                UInt32 from_scale = 0;
133
134
2.84k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
2.84k
                    const auto* from_decimal_type =
136
2.84k
                            check_and_get_data_type<FromDataType>(from_type.get());
137
2.84k
                    from_precision =
138
2.84k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
2.84k
                    from_scale = from_decimal_type->get_scale();
140
2.84k
                }
141
142
2.84k
                UInt32 to_max_digits = 0;
143
2.84k
                UInt32 to_precision = 0;
144
2.84k
                UInt32 to_scale = 0;
145
146
2.84k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
2.84k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
2.84k
                    const auto* to_decimal_type =
150
2.84k
                            check_and_get_data_type<ToDataType>(to_type.get());
151
2.84k
                    to_precision = to_decimal_type->get_precision();
152
2.84k
                    ToDataType::check_type_precision(to_precision);
153
154
2.84k
                    to_scale = to_decimal_type->get_scale();
155
2.84k
                    ToDataType::check_type_scale(to_scale);
156
2.84k
                }
157
2.84k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
2.84k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
2.84k
                    to_precision = to_max_digits;
160
2.84k
                }
161
162
2.84k
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
2.84k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
2.84k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
2.84k
                if (to_scale > from_scale) {
167
2.84k
                    multiply_may_overflow &=
168
2.84k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
2.84k
                }
170
2.84k
                return narrow_integral || multiply_may_overflow;
171
2.84k
            }
172
2.84k
            return false;
173
2.84k
        });
174
2.84k
    };
Unexecuted instantiation: function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_
Line
Count
Source
110
71
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
71
        using Types = std::decay_t<decltype(types)>;
112
71
        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
71
        return call_on_index_and_data_type<
120
71
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
121
71
            using Types2 = std::decay_t<decltype(types2)>;
122
71
            using FromDataType = typename Types2::LeftType;
123
71
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
71
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
71
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
71
                return false;
127
71
            }
128
71
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
129
71
                using FromFieldType = typename FromDataType::FieldType;
130
71
                using ToFieldType = typename ToDataType::FieldType;
131
71
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
132
71
                UInt32 from_scale = 0;
133
134
71
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
71
                    const auto* from_decimal_type =
136
71
                            check_and_get_data_type<FromDataType>(from_type.get());
137
71
                    from_precision =
138
71
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
71
                    from_scale = from_decimal_type->get_scale();
140
71
                }
141
142
71
                UInt32 to_max_digits = 0;
143
71
                UInt32 to_precision = 0;
144
71
                UInt32 to_scale = 0;
145
146
71
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
71
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
71
                    const auto* to_decimal_type =
150
71
                            check_and_get_data_type<ToDataType>(to_type.get());
151
71
                    to_precision = to_decimal_type->get_precision();
152
71
                    ToDataType::check_type_precision(to_precision);
153
154
71
                    to_scale = to_decimal_type->get_scale();
155
71
                    ToDataType::check_type_scale(to_scale);
156
71
                }
157
71
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
71
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
71
                    to_precision = to_max_digits;
160
71
                }
161
162
71
                bool narrow_integral = context->check_overflow_for_decimal() &&
163
71
                                       (to_precision - to_scale) <= (from_precision - from_scale);
164
165
71
                bool multiply_may_overflow = context->check_overflow_for_decimal();
166
71
                if (to_scale > from_scale) {
167
71
                    multiply_may_overflow &=
168
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
71
                }
170
71
                return narrow_integral || multiply_may_overflow;
171
71
            }
172
71
            return false;
173
71
        });
174
71
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
110
72
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
72
        using Types = std::decay_t<decltype(types)>;
112
72
        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
72
        return call_on_index_and_data_type<
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
72
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
72
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
72
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
72
                return false;
127
72
            }
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
72
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
72
                    const auto* from_decimal_type =
136
72
                            check_and_get_data_type<FromDataType>(from_type.get());
137
72
                    from_precision =
138
72
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
72
                    from_scale = from_decimal_type->get_scale();
140
72
                }
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
72
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
72
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
72
                    to_precision = to_max_digits;
160
72
                }
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
72
                    multiply_may_overflow &=
168
72
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
72
                }
170
72
                return narrow_integral || multiply_may_overflow;
171
72
            }
172
72
            return false;
173
72
        });
174
72
    };
Unexecuted instantiation: function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_
Line
Count
Source
110
16
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
16
        using Types = std::decay_t<decltype(types)>;
112
16
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
            return false;
118
        }
119
16
        return call_on_index_and_data_type<
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
16
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
16
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
16
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
16
                return false;
127
16
            }
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
16
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
16
                    const auto* from_decimal_type =
136
16
                            check_and_get_data_type<FromDataType>(from_type.get());
137
16
                    from_precision =
138
16
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
16
                    from_scale = from_decimal_type->get_scale();
140
16
                }
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
16
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
16
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
16
                    to_precision = to_max_digits;
160
16
                }
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
16
            return false;
173
16
        });
174
16
    };
Unexecuted instantiation: function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_
Line
Count
Source
110
7
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
7
        using Types = std::decay_t<decltype(types)>;
112
7
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
7
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
7
            return false;
118
7
        }
119
0
        return call_on_index_and_data_type<
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
7
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
7
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
7
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
7
                return false;
127
7
            }
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
7
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
7
                    const auto* from_decimal_type =
136
7
                            check_and_get_data_type<FromDataType>(from_type.get());
137
7
                    from_precision =
138
7
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
7
                    from_scale = from_decimal_type->get_scale();
140
7
                }
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
7
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
7
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
7
                    to_precision = to_max_digits;
160
7
                }
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
7
                    multiply_may_overflow &=
168
7
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
7
                }
170
7
                return narrow_integral || multiply_may_overflow;
171
7
            }
172
7
            return false;
173
7
        });
174
7
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_
Line
Count
Source
110
10
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
10
        using Types = std::decay_t<decltype(types)>;
112
10
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
10
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
10
            return false;
118
10
        }
119
0
        return call_on_index_and_data_type<
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
10
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
10
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
10
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
10
                return false;
127
10
            }
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
10
                if constexpr (IsDataTypeDecimal<ToDataType>) {
147
10
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
148
149
10
                    const auto* to_decimal_type =
150
10
                            check_and_get_data_type<ToDataType>(to_type.get());
151
10
                    to_precision = to_decimal_type->get_precision();
152
10
                    ToDataType::check_type_precision(to_precision);
153
154
10
                    to_scale = to_decimal_type->get_scale();
155
10
                    ToDataType::check_type_scale(to_scale);
156
10
                }
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
10
                    multiply_may_overflow &=
168
10
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
10
                }
170
10
                return narrow_integral || multiply_may_overflow;
171
10
            }
172
10
            return false;
173
10
        });
174
10
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_
Line
Count
Source
110
31
    auto make_default_wrapper = [&](const auto& types) -> bool {
111
31
        using Types = std::decay_t<decltype(types)>;
112
31
        using ToDataType = typename Types::LeftType;
113
114
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
115
                        IsDatelikeV2Types<ToDataType> ||
116
31
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
117
31
            return false;
118
31
        }
119
0
        return call_on_index_and_data_type<
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
31
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
124
31
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
125
31
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
126
31
                return false;
127
31
            }
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
31
                if constexpr (IsDataTypeDecimal<FromDataType>) {
135
31
                    const auto* from_decimal_type =
136
31
                            check_and_get_data_type<FromDataType>(from_type.get());
137
31
                    from_precision =
138
31
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
139
31
                    from_scale = from_decimal_type->get_scale();
140
31
                }
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
31
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
158
31
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
159
31
                    to_precision = to_max_digits;
160
31
                }
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
31
                if (to_scale > from_scale) {
167
31
                    multiply_may_overflow &=
168
31
                            (from_precision + to_scale - from_scale) >= to_max_digits;
169
31
                }
170
31
                return narrow_integral || multiply_may_overflow;
171
31
            }
172
31
            return false;
173
31
        });
174
31
    };
175
176
84.8k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
177
84.9k
}
178
179
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
180
84.9k
                                    const DataTypePtr& to_type) {
181
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
182
84.9k
    bool result_is_nullable = to_type->is_nullable();
183
184
84.9k
    if (result_is_nullable) {
185
84.9k
        return [from_type, to_type](FunctionContext* context, Block& block,
186
84.9k
                                    const ColumnNumbers& arguments, uint32_t result,
187
84.9k
                                    size_t input_rows_count,
188
84.9k
                                    const NullMap::value_type* null_map = nullptr) {
189
84.9k
            auto from_type_not_nullable = remove_nullable(from_type);
190
84.9k
            auto to_type_not_nullable = remove_nullable(to_type);
191
192
84.9k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
193
84.9k
                    context, from_type_not_nullable, to_type_not_nullable);
194
195
84.9k
            auto nested_result_index = block.columns();
196
84.9k
            block.insert(block.get_by_position(result).unnest_nullable());
197
84.9k
            auto nested_source_index = block.columns();
198
84.9k
            block.insert(block.get_by_position(arguments[0])
199
84.9k
                                 .unnest_nullable(replace_null_data_to_default));
200
201
84.9k
            const auto& arg_col = block.get_by_position(arguments[0]);
202
84.9k
            const NullMap::value_type* arg_null_map = nullptr;
203
84.9k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
204
84.9k
                arg_null_map = nullable->get_null_map_data().data();
205
84.9k
            }
206
84.9k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
207
84.9k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
208
84.9k
                    arg_null_map));
209
210
61.2k
            block.get_by_position(result).column =
211
61.2k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
212
61.2k
                                     arguments, input_rows_count);
213
214
61.2k
            block.erase(nested_source_index);
215
61.2k
            block.erase(nested_result_index);
216
61.2k
            return Status::OK();
217
84.9k
        };
218
84.9k
    } else {
219
20
        return prepare_impl(context, from_type, to_type);
220
20
    }
221
84.9k
}
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
84.9k
                         const DataTypePtr& origin_to_type) {
227
84.9k
    auto to_type = get_serialized_type(origin_to_type);
228
84.9k
    auto from_type = get_serialized_type(origin_from_type);
229
84.9k
    if (from_type->equals(*to_type)) {
230
131
        return create_identity_wrapper(from_type);
231
131
    }
232
233
    // variant needs to be judged first
234
84.8k
    if (to_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
235
3
        return create_cast_to_variant_wrapper(from_type,
236
3
                                              static_cast<const DataTypeVariant&>(*to_type));
237
3
    }
238
84.8k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
239
10
        return create_cast_from_variant_wrapper(static_cast<const DataTypeVariant&>(*from_type),
240
10
                                                to_type);
241
10
    }
242
243
84.8k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
244
113
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
245
113
                                              to_type,
246
113
                                              context ? context->jsonb_string_as_string() : false);
247
113
    }
248
249
84.7k
    switch (to_type->get_primitive_type()) {
250
32
    case PrimitiveType::TYPE_BOOLEAN:
251
32
        return create_boolean_wrapper(context, from_type);
252
1.42k
    case PrimitiveType::TYPE_TINYINT:
253
2.83k
    case PrimitiveType::TYPE_SMALLINT:
254
4.09k
    case PrimitiveType::TYPE_INT:
255
5.11k
    case PrimitiveType::TYPE_BIGINT:
256
6.19k
    case PrimitiveType::TYPE_LARGEINT:
257
6.19k
        return create_int_wrapper(context, from_type, to_type->get_primitive_type());
258
8.17k
    case PrimitiveType::TYPE_FLOAT:
259
16.4k
    case PrimitiveType::TYPE_DOUBLE:
260
16.4k
        return create_float_wrapper(context, from_type, to_type->get_primitive_type());
261
0
    case PrimitiveType::TYPE_DATE:
262
0
    case PrimitiveType::TYPE_DATETIME:
263
71
    case PrimitiveType::TYPE_DATEV2:
264
143
    case PrimitiveType::TYPE_DATETIMEV2:
265
159
    case PrimitiveType::TYPE_TIMEV2:
266
159
        return create_datelike_wrapper(context, from_type, to_type->get_primitive_type());
267
0
    case PrimitiveType::TYPE_TIMESTAMPTZ:
268
0
        return create_timestamptz_wrapper(context, from_type);
269
7
    case PrimitiveType::TYPE_IPV4:
270
17
    case PrimitiveType::TYPE_IPV6:
271
17
        return create_ip_wrapper(context, from_type, to_type->get_primitive_type());
272
4
    case PrimitiveType::TYPE_DECIMALV2:
273
3.23k
    case PrimitiveType::TYPE_DECIMAL32:
274
6.45k
    case PrimitiveType::TYPE_DECIMAL64:
275
9.46k
    case PrimitiveType::TYPE_DECIMAL128I:
276
12.3k
    case PrimitiveType::TYPE_DECIMAL256:
277
12.3k
        return create_decimal_wrapper(context, from_type, to_type->get_primitive_type());
278
0
    case PrimitiveType::TYPE_CHAR:
279
0
    case PrimitiveType::TYPE_VARCHAR:
280
14
    case PrimitiveType::TYPE_STRING:
281
14
        return create_string_wrapper(from_type);
282
1.41k
    case PrimitiveType::TYPE_ARRAY:
283
1.41k
        return create_array_wrapper(context, from_type,
284
1.41k
                                    static_cast<const DataTypeArray&>(*to_type));
285
2
    case PrimitiveType::TYPE_STRUCT:
286
2
        return create_struct_wrapper(context, from_type,
287
2
                                     static_cast<const DataTypeStruct&>(*to_type));
288
3
    case PrimitiveType::TYPE_MAP:
289
3
        return create_map_wrapper(context, from_type, static_cast<const DataTypeMap&>(*to_type));
290
0
    case PrimitiveType::TYPE_HLL:
291
0
        return create_hll_wrapper(context, from_type, static_cast<const DataTypeHLL&>(*to_type));
292
0
    case PrimitiveType::TYPE_BITMAP:
293
0
        return create_bitmap_wrapper(context, from_type,
294
0
                                     static_cast<const DataTypeBitMap&>(*to_type));
295
0
    case PrimitiveType::TYPE_QUANTILE_STATE:
296
0
        return create_quantile_state_wrapper(context, from_type,
297
0
                                             static_cast<const DataTypeQuantileState&>(*to_type));
298
48.1k
    case PrimitiveType::TYPE_JSONB:
299
48.1k
        return create_cast_to_jsonb_wrapper(from_type, static_cast<const DataTypeJsonb&>(*to_type),
300
48.1k
                                            context ? context->string_as_jsonb_string() : false);
301
0
    case PrimitiveType::TYPE_VARBINARY:
302
0
        return create_varbinary_wrapper(from_type);
303
0
    default:
304
0
        break;
305
84.7k
    }
306
307
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
308
84.7k
}
309
310
} // namespace CastWrapper
311
312
class PreparedFunctionCast : public PreparedFunctionImpl {
313
public:
314
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
315
83.5k
            : 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
83.5k
                        uint32_t result, size_t input_rows_count) const override {
322
83.5k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
323
83.5k
    }
324
325
83.5k
    bool use_default_implementation_for_nulls() const override { return false; }
326
83.5k
    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
84.1k
            : name(name_),
337
84.1k
              argument_types(std::move(argument_types_)),
338
84.1k
              return_type(std::move(return_type_)) {}
339
340
83.5k
    const DataTypes& get_argument_types() const override { return argument_types; }
341
83.5k
    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
83.5k
                                uint32_t /*result*/) const override {
346
83.5k
        return std::make_shared<PreparedFunctionCast>(
347
83.5k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
348
83.5k
                                                         get_return_type()),
349
83.5k
                name);
350
83.5k
    }
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
84.2k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
367
368
84.2k
    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
84.1k
                               const DataTypePtr& return_type) const override {
379
84.1k
        DataTypes data_types(arguments.size());
380
381
252k
        for (size_t i = 0; i < arguments.size(); ++i) {
382
168k
            data_types[i] = arguments[i].type;
383
168k
        }
384
385
84.1k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
386
84.1k
    }
387
388
84.1k
    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
1
void register_function_cast(SimpleFunctionFactory& factory) {
397
1
    factory.register_function<FunctionBuilderCast>();
398
1
}
399
} // namespace doris