Coverage Report

Created: 2026-03-16 16:03

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_boolean.h"
27
#include "exprs/function/cast/cast_to_date.h"
28
#include "exprs/function/cast/cast_to_decimal.h"
29
#include "exprs/function/cast/cast_to_float.h"
30
#include "exprs/function/cast/cast_to_int.h"
31
#include "exprs/function/cast/cast_to_ip.h"
32
#include "exprs/function/cast/cast_to_jsonb.h"
33
#include "exprs/function/cast/cast_to_map.h"
34
#include "exprs/function/cast/cast_to_string.h"
35
#include "exprs/function/cast/cast_to_struct.h"
36
#include "exprs/function/cast/cast_to_timestamptz.h"
37
#include "exprs/function/cast/cast_to_variant.h"
38
#include "exprs/function/simple_function_factory.h"
39
40
namespace doris {
41
42
namespace CastWrapper {
43
44
WrapperType create_hll_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
45
0
                               const DataTypeHLL& to_type) {
46
    /// Conversion from String through parsing.
47
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
48
0
        return cast_from_string_to_generic;
49
0
    }
50
51
0
    return CastWrapper::create_unsupport_wrapper("Cast to HLL only support from String type");
52
0
}
53
54
WrapperType create_bitmap_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
55
0
                                  const DataTypeBitMap& to_type) {
56
    /// Conversion from String through parsing.
57
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
58
0
        return cast_from_string_to_generic;
59
0
    }
60
61
0
    return CastWrapper::create_unsupport_wrapper("Cast to BitMap only support from String type");
62
0
}
63
64
WrapperType create_quantile_state_wrapper(FunctionContext* context,
65
                                          const DataTypePtr& from_type_untyped,
66
0
                                          const DataTypeQuantileState& to_type) {
67
    /// Conversion from String through parsing.
68
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
69
0
        return cast_from_string_to_generic;
70
0
    }
71
72
0
    return CastWrapper::create_unsupport_wrapper(
73
0
            "Cast to QuantileState only support from String type");
74
0
}
75
76
0
WrapperType create_varbinary_wrapper(const DataTypePtr& from_type_untyped) {
77
    /// Conversion from String through parsing.
78
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
79
0
        return cast_from_string_to_generic;
80
0
    }
81
82
0
    return CastWrapper::create_unsupport_wrapper("Cast to Varbinary only support from String type");
83
0
}
84
85
WrapperType prepare_unpack_dictionaries(FunctionContext* context, const DataTypePtr& from_type,
86
84.8k
                                        const DataTypePtr& to_type) {
87
84.8k
    const auto& from_nested = from_type;
88
84.8k
    const auto& to_nested = to_type;
89
90
84.8k
    if (from_type->is_null_literal()) {
91
0
        if (!to_nested->is_nullable()) {
92
0
            return CastWrapper::create_unsupport_wrapper(
93
0
                    "Cannot convert NULL to a non-nullable type");
94
0
        }
95
96
0
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
97
0
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
98
            /// TODO: remove this in the future.
99
0
            auto& res = block.get_by_position(result);
100
0
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
101
0
                                 ->convert_to_full_column_if_const();
102
0
            return Status::OK();
103
0
        };
104
0
    }
105
106
84.8k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
107
108
84.8k
    return wrapper;
109
84.8k
}
110
111
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
112
84.8k
                                       const DataTypePtr& to_type) {
113
84.8k
    if (from_type->equals(*to_type)) {
114
126
        return false;
115
126
    }
116
117
84.7k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
35.2k
        using Types = std::decay_t<decltype(types)>;
119
35.2k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
48
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
48
            return false;
125
48
        }
126
0
        return call_on_index_and_data_type<
127
35.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
35.1k
            using Types2 = std::decay_t<decltype(types2)>;
129
35.1k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
10.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
10.2k
                return false;
134
10.2k
            }
135
12.8k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
12.8k
                using FromFieldType = typename FromDataType::FieldType;
137
12.8k
                using ToFieldType = typename ToDataType::FieldType;
138
12.8k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
12.8k
                UInt32 from_scale = 0;
140
141
12.8k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5.45k
                    const auto* from_decimal_type =
143
5.45k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5.45k
                    from_precision =
145
5.45k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5.45k
                    from_scale = from_decimal_type->get_scale();
147
5.45k
                }
148
149
12.8k
                UInt32 to_max_digits = 0;
150
12.8k
                UInt32 to_precision = 0;
151
12.8k
                UInt32 to_scale = 0;
152
153
12.8k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
12.3k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
12.3k
                    const auto* to_decimal_type =
157
12.3k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
12.3k
                    to_precision = to_decimal_type->get_precision();
159
12.3k
                    ToDataType::check_type_precision(to_precision);
160
161
12.3k
                    to_scale = to_decimal_type->get_scale();
162
12.3k
                    ToDataType::check_type_scale(to_scale);
163
12.3k
                }
164
12.8k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
573
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
573
                    to_precision = to_max_digits;
167
573
                }
168
169
12.8k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
12.8k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
12.8k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
12.8k
                if (to_scale > from_scale) {
174
3.13k
                    multiply_may_overflow &=
175
3.13k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
3.13k
                }
177
12.8k
                return narrow_integral || multiply_may_overflow;
178
12.8k
            }
179
0
            return false;
180
35.1k
        });
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2
                using FromFieldType = typename FromDataType::FieldType;
137
2
                using ToFieldType = typename ToDataType::FieldType;
138
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2
                UInt32 from_scale = 0;
140
141
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2
                    const auto* from_decimal_type =
143
2
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2
                    from_precision =
145
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2
                    from_scale = from_decimal_type->get_scale();
147
2
                }
148
149
2
                UInt32 to_max_digits = 0;
150
2
                UInt32 to_precision = 0;
151
2
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
2
                    to_precision = to_max_digits;
167
2
                }
168
169
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
2
                return narrow_integral || multiply_may_overflow;
178
2
            }
179
0
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2
                using FromFieldType = typename FromDataType::FieldType;
137
2
                using ToFieldType = typename ToDataType::FieldType;
138
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2
                UInt32 from_scale = 0;
140
141
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2
                    const auto* from_decimal_type =
143
2
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2
                    from_precision =
145
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2
                    from_scale = from_decimal_type->get_scale();
147
2
                }
148
149
2
                UInt32 to_max_digits = 0;
150
2
                UInt32 to_precision = 0;
151
2
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
2
                    to_precision = to_max_digits;
167
2
                }
168
169
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
2
                return narrow_integral || multiply_may_overflow;
178
2
            }
179
0
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2
                using FromFieldType = typename FromDataType::FieldType;
137
2
                using ToFieldType = typename ToDataType::FieldType;
138
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2
                UInt32 from_scale = 0;
140
141
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2
                    const auto* from_decimal_type =
143
2
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2
                    from_precision =
145
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2
                    from_scale = from_decimal_type->get_scale();
147
2
                }
148
149
2
                UInt32 to_max_digits = 0;
150
2
                UInt32 to_precision = 0;
151
2
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
2
                    to_precision = to_max_digits;
167
2
                }
168
169
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
2
                return narrow_integral || multiply_may_overflow;
178
2
            }
179
0
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2
                using FromFieldType = typename FromDataType::FieldType;
137
2
                using ToFieldType = typename ToDataType::FieldType;
138
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2
                UInt32 from_scale = 0;
140
141
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2
                    const auto* from_decimal_type =
143
2
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2
                    from_precision =
145
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2
                    from_scale = from_decimal_type->get_scale();
147
2
                }
148
149
2
                UInt32 to_max_digits = 0;
150
2
                UInt32 to_precision = 0;
151
2
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
2
                    to_precision = to_max_digits;
167
2
                }
168
169
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
2
                return narrow_integral || multiply_may_overflow;
178
2
            }
179
0
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2
                using FromFieldType = typename FromDataType::FieldType;
137
2
                using ToFieldType = typename ToDataType::FieldType;
138
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2
                UInt32 from_scale = 0;
140
141
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2
                    const auto* from_decimal_type =
143
2
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2
                    from_precision =
145
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2
                    from_scale = from_decimal_type->get_scale();
147
2
                }
148
149
2
                UInt32 to_max_digits = 0;
150
2
                UInt32 to_precision = 0;
151
2
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
2
                    to_precision = to_max_digits;
167
2
                }
168
169
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
2
                return narrow_integral || multiply_may_overflow;
178
2
            }
179
0
            return false;
180
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
127
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
12
            using Types2 = std::decay_t<decltype(types2)>;
129
12
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
12
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
12
                return false;
134
12
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
12
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
23
            using Types2 = std::decay_t<decltype(types2)>;
129
23
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
23
            return false;
180
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
127
27
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
27
            using Types2 = std::decay_t<decltype(types2)>;
129
27
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
27
            return false;
180
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
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
14
                using FromFieldType = typename FromDataType::FieldType;
137
14
                using ToFieldType = typename ToDataType::FieldType;
138
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
14
                UInt32 from_scale = 0;
140
141
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
14
                    const auto* from_decimal_type =
143
14
                            check_and_get_data_type<FromDataType>(from_type.get());
144
14
                    from_precision =
145
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
14
                    from_scale = from_decimal_type->get_scale();
147
14
                }
148
149
14
                UInt32 to_max_digits = 0;
150
14
                UInt32 to_precision = 0;
151
14
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
14
                    to_precision = to_max_digits;
167
14
                }
168
169
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
14
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
14
                return narrow_integral || multiply_may_overflow;
178
14
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8
            using Types2 = std::decay_t<decltype(types2)>;
129
8
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
8
                using FromFieldType = typename FromDataType::FieldType;
137
8
                using ToFieldType = typename ToDataType::FieldType;
138
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
8
                UInt32 from_scale = 0;
140
141
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
8
                    const auto* from_decimal_type =
143
8
                            check_and_get_data_type<FromDataType>(from_type.get());
144
8
                    from_precision =
145
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
8
                    from_scale = from_decimal_type->get_scale();
147
8
                }
148
149
8
                UInt32 to_max_digits = 0;
150
8
                UInt32 to_precision = 0;
151
8
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
8
                    to_precision = to_max_digits;
167
8
                }
168
169
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
8
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
8
                return narrow_integral || multiply_may_overflow;
178
8
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
72
            using Types2 = std::decay_t<decltype(types2)>;
129
72
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
72
            return false;
180
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
127
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
24
            using Types2 = std::decay_t<decltype(types2)>;
129
24
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
24
            return false;
180
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
127
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
320
            using Types2 = std::decay_t<decltype(types2)>;
129
320
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
320
            return false;
180
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
127
857
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
857
            using Types2 = std::decay_t<decltype(types2)>;
129
857
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
857
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
857
                return false;
134
857
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
857
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
21
            using Types2 = std::decay_t<decltype(types2)>;
129
21
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
21
            return false;
180
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
127
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
25
            using Types2 = std::decay_t<decltype(types2)>;
129
25
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
25
            return false;
180
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
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
14
                using FromFieldType = typename FromDataType::FieldType;
137
14
                using ToFieldType = typename ToDataType::FieldType;
138
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
14
                UInt32 from_scale = 0;
140
141
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
14
                    const auto* from_decimal_type =
143
14
                            check_and_get_data_type<FromDataType>(from_type.get());
144
14
                    from_precision =
145
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
14
                    from_scale = from_decimal_type->get_scale();
147
14
                }
148
149
14
                UInt32 to_max_digits = 0;
150
14
                UInt32 to_precision = 0;
151
14
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
14
                    to_precision = to_max_digits;
167
14
                }
168
169
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
14
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
14
                return narrow_integral || multiply_may_overflow;
178
14
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8
            using Types2 = std::decay_t<decltype(types2)>;
129
8
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
8
                using FromFieldType = typename FromDataType::FieldType;
137
8
                using ToFieldType = typename ToDataType::FieldType;
138
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
8
                UInt32 from_scale = 0;
140
141
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
8
                    const auto* from_decimal_type =
143
8
                            check_and_get_data_type<FromDataType>(from_type.get());
144
8
                    from_precision =
145
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
8
                    from_scale = from_decimal_type->get_scale();
147
8
                }
148
149
8
                UInt32 to_max_digits = 0;
150
8
                UInt32 to_precision = 0;
151
8
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
8
                    to_precision = to_max_digits;
167
8
                }
168
169
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
8
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
8
                return narrow_integral || multiply_may_overflow;
178
8
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
72
            using Types2 = std::decay_t<decltype(types2)>;
129
72
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
72
            return false;
180
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
127
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
24
            using Types2 = std::decay_t<decltype(types2)>;
129
24
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
24
            return false;
180
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
127
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
320
            using Types2 = std::decay_t<decltype(types2)>;
129
320
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
320
            return false;
180
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
127
841
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
841
            using Types2 = std::decay_t<decltype(types2)>;
129
841
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
841
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
841
                return false;
134
841
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
841
            return false;
180
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
127
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4
            using Types2 = std::decay_t<decltype(types2)>;
129
4
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
4
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
17
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
17
            using Types2 = std::decay_t<decltype(types2)>;
129
17
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
17
            return false;
180
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
127
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
21
            using Types2 = std::decay_t<decltype(types2)>;
129
21
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
21
            return false;
180
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
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
14
                using FromFieldType = typename FromDataType::FieldType;
137
14
                using ToFieldType = typename ToDataType::FieldType;
138
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
14
                UInt32 from_scale = 0;
140
141
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
14
                    const auto* from_decimal_type =
143
14
                            check_and_get_data_type<FromDataType>(from_type.get());
144
14
                    from_precision =
145
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
14
                    from_scale = from_decimal_type->get_scale();
147
14
                }
148
149
14
                UInt32 to_max_digits = 0;
150
14
                UInt32 to_precision = 0;
151
14
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
14
                    to_precision = to_max_digits;
167
14
                }
168
169
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
14
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
14
                return narrow_integral || multiply_may_overflow;
178
14
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8
            using Types2 = std::decay_t<decltype(types2)>;
129
8
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
8
                using FromFieldType = typename FromDataType::FieldType;
137
8
                using ToFieldType = typename ToDataType::FieldType;
138
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
8
                UInt32 from_scale = 0;
140
141
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
8
                    const auto* from_decimal_type =
143
8
                            check_and_get_data_type<FromDataType>(from_type.get());
144
8
                    from_precision =
145
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
8
                    from_scale = from_decimal_type->get_scale();
147
8
                }
148
149
8
                UInt32 to_max_digits = 0;
150
8
                UInt32 to_precision = 0;
151
8
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
8
                    to_precision = to_max_digits;
167
8
                }
168
169
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
8
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
8
                return narrow_integral || multiply_may_overflow;
178
8
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
24
            using Types2 = std::decay_t<decltype(types2)>;
129
24
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
24
            return false;
180
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
127
276
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
276
            using Types2 = std::decay_t<decltype(types2)>;
129
276
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
276
            return false;
180
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
127
825
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
825
            using Types2 = std::decay_t<decltype(types2)>;
129
825
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
825
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
825
                return false;
134
825
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
825
            return false;
180
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
127
79
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
79
            using Types2 = std::decay_t<decltype(types2)>;
129
79
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
79
            return false;
180
79
        });
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
13
            using Types2 = std::decay_t<decltype(types2)>;
129
13
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
13
            return false;
180
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
127
17
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
17
            using Types2 = std::decay_t<decltype(types2)>;
129
17
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
17
            return false;
180
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
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
14
                using FromFieldType = typename FromDataType::FieldType;
137
14
                using ToFieldType = typename ToDataType::FieldType;
138
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
14
                UInt32 from_scale = 0;
140
141
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
14
                    const auto* from_decimal_type =
143
14
                            check_and_get_data_type<FromDataType>(from_type.get());
144
14
                    from_precision =
145
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
14
                    from_scale = from_decimal_type->get_scale();
147
14
                }
148
149
14
                UInt32 to_max_digits = 0;
150
14
                UInt32 to_precision = 0;
151
14
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
14
                    to_precision = to_max_digits;
167
14
                }
168
169
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
14
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
14
                return narrow_integral || multiply_may_overflow;
178
14
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8
            using Types2 = std::decay_t<decltype(types2)>;
129
8
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
8
                using FromFieldType = typename FromDataType::FieldType;
137
8
                using ToFieldType = typename ToDataType::FieldType;
138
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
8
                UInt32 from_scale = 0;
140
141
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
8
                    const auto* from_decimal_type =
143
8
                            check_and_get_data_type<FromDataType>(from_type.get());
144
8
                    from_precision =
145
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
8
                    from_scale = from_decimal_type->get_scale();
147
8
                }
148
149
8
                UInt32 to_max_digits = 0;
150
8
                UInt32 to_precision = 0;
151
8
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
8
                    to_precision = to_max_digits;
167
8
                }
168
169
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
8
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
8
                return narrow_integral || multiply_may_overflow;
178
8
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8
            using Types2 = std::decay_t<decltype(types2)>;
129
8
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
8
            return false;
180
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
127
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4
            using Types2 = std::decay_t<decltype(types2)>;
129
4
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
4
            return false;
180
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
127
809
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
809
            using Types2 = std::decay_t<decltype(types2)>;
129
809
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
809
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
809
                return false;
134
809
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
809
            return false;
180
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
127
97
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
97
            using Types2 = std::decay_t<decltype(types2)>;
129
97
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
97
            return false;
180
97
        });
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
95
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
95
            using Types2 = std::decay_t<decltype(types2)>;
129
95
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
95
            return false;
180
95
        });
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
127
9
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
9
            using Types2 = std::decay_t<decltype(types2)>;
129
9
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
9
            return false;
180
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
127
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
13
            using Types2 = std::decay_t<decltype(types2)>;
129
13
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
13
            return false;
180
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
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
14
                using FromFieldType = typename FromDataType::FieldType;
137
14
                using ToFieldType = typename ToDataType::FieldType;
138
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
14
                UInt32 from_scale = 0;
140
141
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
14
                    const auto* from_decimal_type =
143
14
                            check_and_get_data_type<FromDataType>(from_type.get());
144
14
                    from_precision =
145
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
14
                    from_scale = from_decimal_type->get_scale();
147
14
                }
148
149
14
                UInt32 to_max_digits = 0;
150
14
                UInt32 to_precision = 0;
151
14
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
14
                    to_precision = to_max_digits;
167
14
                }
168
169
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
14
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
14
                return narrow_integral || multiply_may_overflow;
178
14
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8
            using Types2 = std::decay_t<decltype(types2)>;
129
8
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
8
                using FromFieldType = typename FromDataType::FieldType;
137
8
                using ToFieldType = typename ToDataType::FieldType;
138
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
8
                UInt32 from_scale = 0;
140
141
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
8
                    const auto* from_decimal_type =
143
8
                            check_and_get_data_type<FromDataType>(from_type.get());
144
8
                    from_precision =
145
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
8
                    from_scale = from_decimal_type->get_scale();
147
8
                }
148
149
8
                UInt32 to_max_digits = 0;
150
8
                UInt32 to_precision = 0;
151
8
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
8
                    to_precision = to_max_digits;
167
8
                }
168
169
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
8
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
8
                return narrow_integral || multiply_may_overflow;
178
8
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8
            using Types2 = std::decay_t<decltype(types2)>;
129
8
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
8
            return false;
180
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
127
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4
            using Types2 = std::decay_t<decltype(types2)>;
129
4
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
4
            return false;
180
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
127
793
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
793
            using Types2 = std::decay_t<decltype(types2)>;
129
793
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
793
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
793
                return false;
134
793
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
793
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
14
                using FromFieldType = typename FromDataType::FieldType;
137
14
                using ToFieldType = typename ToDataType::FieldType;
138
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
14
                UInt32 from_scale = 0;
140
141
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
14
                    const auto* from_decimal_type =
143
14
                            check_and_get_data_type<FromDataType>(from_type.get());
144
14
                    from_precision =
145
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
14
                    from_scale = from_decimal_type->get_scale();
147
14
                }
148
149
14
                UInt32 to_max_digits = 0;
150
14
                UInt32 to_precision = 0;
151
14
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
14
                    to_precision = to_max_digits;
167
14
                }
168
169
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
14
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
14
                return narrow_integral || multiply_may_overflow;
178
14
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
14
                using FromFieldType = typename FromDataType::FieldType;
137
14
                using ToFieldType = typename ToDataType::FieldType;
138
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
14
                UInt32 from_scale = 0;
140
141
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
14
                    const auto* from_decimal_type =
143
14
                            check_and_get_data_type<FromDataType>(from_type.get());
144
14
                    from_precision =
145
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
14
                    from_scale = from_decimal_type->get_scale();
147
14
                }
148
149
14
                UInt32 to_max_digits = 0;
150
14
                UInt32 to_precision = 0;
151
14
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
14
                    to_precision = to_max_digits;
167
14
                }
168
169
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
14
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
14
                return narrow_integral || multiply_may_overflow;
178
14
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
36
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
36
            using Types2 = std::decay_t<decltype(types2)>;
129
36
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
36
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
36
                using FromFieldType = typename FromDataType::FieldType;
137
36
                using ToFieldType = typename ToDataType::FieldType;
138
36
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
36
                UInt32 from_scale = 0;
140
141
36
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
36
                    const auto* from_decimal_type =
143
36
                            check_and_get_data_type<FromDataType>(from_type.get());
144
36
                    from_precision =
145
36
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
36
                    from_scale = from_decimal_type->get_scale();
147
36
                }
148
149
36
                UInt32 to_max_digits = 0;
150
36
                UInt32 to_precision = 0;
151
36
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
36
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
36
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
36
                    to_precision = to_max_digits;
167
36
                }
168
169
36
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
36
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
36
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
36
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
36
                return narrow_integral || multiply_may_overflow;
178
36
            }
179
0
            return false;
180
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
127
37
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
37
            using Types2 = std::decay_t<decltype(types2)>;
129
37
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
37
            return false;
180
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
127
7.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.78k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.78k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7.78k
            return false;
180
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
127
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
162
            using Types2 = std::decay_t<decltype(types2)>;
129
162
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
162
            return false;
180
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
127
80
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
80
            using Types2 = std::decay_t<decltype(types2)>;
129
80
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
80
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
80
                return false;
134
80
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
80
            return false;
180
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
127
86
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
86
            using Types2 = std::decay_t<decltype(types2)>;
129
86
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
86
            return false;
180
86
        });
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
14
                using FromFieldType = typename FromDataType::FieldType;
137
14
                using ToFieldType = typename ToDataType::FieldType;
138
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
14
                UInt32 from_scale = 0;
140
141
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
14
                    const auto* from_decimal_type =
143
14
                            check_and_get_data_type<FromDataType>(from_type.get());
144
14
                    from_precision =
145
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
14
                    from_scale = from_decimal_type->get_scale();
147
14
                }
148
149
14
                UInt32 to_max_digits = 0;
150
14
                UInt32 to_precision = 0;
151
14
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
14
                    to_precision = to_max_digits;
167
14
                }
168
169
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
14
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
14
                return narrow_integral || multiply_may_overflow;
178
14
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
14
                using FromFieldType = typename FromDataType::FieldType;
137
14
                using ToFieldType = typename ToDataType::FieldType;
138
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
14
                UInt32 from_scale = 0;
140
141
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
14
                    const auto* from_decimal_type =
143
14
                            check_and_get_data_type<FromDataType>(from_type.get());
144
14
                    from_precision =
145
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
14
                    from_scale = from_decimal_type->get_scale();
147
14
                }
148
149
14
                UInt32 to_max_digits = 0;
150
14
                UInt32 to_precision = 0;
151
14
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
14
                    to_precision = to_max_digits;
167
14
                }
168
169
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
14
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
14
                return narrow_integral || multiply_may_overflow;
178
14
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
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
127
37
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
37
            using Types2 = std::decay_t<decltype(types2)>;
129
37
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
37
            return false;
180
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
127
7.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.78k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.78k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7.78k
            return false;
180
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
127
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
162
            using Types2 = std::decay_t<decltype(types2)>;
129
162
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
162
            return false;
180
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
127
80
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
80
            using Types2 = std::decay_t<decltype(types2)>;
129
80
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
80
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
80
                return false;
134
80
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
80
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7
                using FromFieldType = typename FromDataType::FieldType;
137
7
                using ToFieldType = typename ToDataType::FieldType;
138
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
7
                UInt32 to_max_digits = 0;
150
7
                UInt32 to_precision = 0;
151
7
                UInt32 to_scale = 0;
152
153
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7
                    const auto* to_decimal_type =
157
7
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7
                    to_precision = to_decimal_type->get_precision();
159
7
                    ToDataType::check_type_precision(to_precision);
160
161
7
                    to_scale = to_decimal_type->get_scale();
162
7
                    ToDataType::check_type_scale(to_scale);
163
7
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7
                if (to_scale > from_scale) {
174
6
                    multiply_may_overflow &=
175
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
6
                }
177
7
                return narrow_integral || multiply_may_overflow;
178
7
            }
179
0
            return false;
180
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
127
34
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
34
            using Types2 = std::decay_t<decltype(types2)>;
129
34
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
34
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
34
                using FromFieldType = typename FromDataType::FieldType;
137
34
                using ToFieldType = typename ToDataType::FieldType;
138
34
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
34
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
34
                UInt32 to_max_digits = 0;
150
34
                UInt32 to_precision = 0;
151
34
                UInt32 to_scale = 0;
152
153
34
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
34
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
34
                    const auto* to_decimal_type =
157
34
                            check_and_get_data_type<ToDataType>(to_type.get());
158
34
                    to_precision = to_decimal_type->get_precision();
159
34
                    ToDataType::check_type_precision(to_precision);
160
161
34
                    to_scale = to_decimal_type->get_scale();
162
34
                    ToDataType::check_type_scale(to_scale);
163
34
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
34
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
34
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
34
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
34
                if (to_scale > from_scale) {
174
23
                    multiply_may_overflow &=
175
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
23
                }
177
34
                return narrow_integral || multiply_may_overflow;
178
34
            }
179
0
            return false;
180
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
127
39
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
39
            using Types2 = std::decay_t<decltype(types2)>;
129
39
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
39
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
39
                using FromFieldType = typename FromDataType::FieldType;
137
39
                using ToFieldType = typename ToDataType::FieldType;
138
39
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
39
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
39
                UInt32 to_max_digits = 0;
150
39
                UInt32 to_precision = 0;
151
39
                UInt32 to_scale = 0;
152
153
39
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
39
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
39
                    const auto* to_decimal_type =
157
39
                            check_and_get_data_type<ToDataType>(to_type.get());
158
39
                    to_precision = to_decimal_type->get_precision();
159
39
                    ToDataType::check_type_precision(to_precision);
160
161
39
                    to_scale = to_decimal_type->get_scale();
162
39
                    ToDataType::check_type_scale(to_scale);
163
39
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
39
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
39
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
39
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
39
                if (to_scale > from_scale) {
174
23
                    multiply_may_overflow &=
175
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
23
                }
177
39
                return narrow_integral || multiply_may_overflow;
178
39
            }
179
0
            return false;
180
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
127
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
49
            using Types2 = std::decay_t<decltype(types2)>;
129
49
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
49
                using FromFieldType = typename FromDataType::FieldType;
137
49
                using ToFieldType = typename ToDataType::FieldType;
138
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
49
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
49
                UInt32 to_max_digits = 0;
150
49
                UInt32 to_precision = 0;
151
49
                UInt32 to_scale = 0;
152
153
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
49
                    const auto* to_decimal_type =
157
49
                            check_and_get_data_type<ToDataType>(to_type.get());
158
49
                    to_precision = to_decimal_type->get_precision();
159
49
                    ToDataType::check_type_precision(to_precision);
160
161
49
                    to_scale = to_decimal_type->get_scale();
162
49
                    ToDataType::check_type_scale(to_scale);
163
49
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
49
                if (to_scale > from_scale) {
174
28
                    multiply_may_overflow &=
175
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
28
                }
177
49
                return narrow_integral || multiply_may_overflow;
178
49
            }
179
0
            return false;
180
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
127
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
49
            using Types2 = std::decay_t<decltype(types2)>;
129
49
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
49
                using FromFieldType = typename FromDataType::FieldType;
137
49
                using ToFieldType = typename ToDataType::FieldType;
138
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
49
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
49
                UInt32 to_max_digits = 0;
150
49
                UInt32 to_precision = 0;
151
49
                UInt32 to_scale = 0;
152
153
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
49
                    const auto* to_decimal_type =
157
49
                            check_and_get_data_type<ToDataType>(to_type.get());
158
49
                    to_precision = to_decimal_type->get_precision();
159
49
                    ToDataType::check_type_precision(to_precision);
160
161
49
                    to_scale = to_decimal_type->get_scale();
162
49
                    ToDataType::check_type_scale(to_scale);
163
49
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
49
                if (to_scale > from_scale) {
174
28
                    multiply_may_overflow &=
175
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
28
                }
177
49
                return narrow_integral || multiply_may_overflow;
178
49
            }
179
0
            return false;
180
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
127
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
49
            using Types2 = std::decay_t<decltype(types2)>;
129
49
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
49
                using FromFieldType = typename FromDataType::FieldType;
137
49
                using ToFieldType = typename ToDataType::FieldType;
138
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
49
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
49
                UInt32 to_max_digits = 0;
150
49
                UInt32 to_precision = 0;
151
49
                UInt32 to_scale = 0;
152
153
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
49
                    const auto* to_decimal_type =
157
49
                            check_and_get_data_type<ToDataType>(to_type.get());
158
49
                    to_precision = to_decimal_type->get_precision();
159
49
                    ToDataType::check_type_precision(to_precision);
160
161
49
                    to_scale = to_decimal_type->get_scale();
162
49
                    ToDataType::check_type_scale(to_scale);
163
49
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
49
                if (to_scale > from_scale) {
174
28
                    multiply_may_overflow &=
175
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
28
                }
177
49
                return narrow_integral || multiply_may_overflow;
178
49
            }
179
0
            return false;
180
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
127
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
99
            using Types2 = std::decay_t<decltype(types2)>;
129
99
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
99
                using FromFieldType = typename FromDataType::FieldType;
137
99
                using ToFieldType = typename ToDataType::FieldType;
138
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
99
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
99
                UInt32 to_max_digits = 0;
150
99
                UInt32 to_precision = 0;
151
99
                UInt32 to_scale = 0;
152
153
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
99
                    const auto* to_decimal_type =
157
99
                            check_and_get_data_type<ToDataType>(to_type.get());
158
99
                    to_precision = to_decimal_type->get_precision();
159
99
                    ToDataType::check_type_precision(to_precision);
160
161
99
                    to_scale = to_decimal_type->get_scale();
162
99
                    ToDataType::check_type_scale(to_scale);
163
99
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
99
                if (to_scale > from_scale) {
174
66
                    multiply_may_overflow &=
175
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
66
                }
177
99
                return narrow_integral || multiply_may_overflow;
178
99
            }
179
0
            return false;
180
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
127
103
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
103
            using Types2 = std::decay_t<decltype(types2)>;
129
103
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
103
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
103
                using FromFieldType = typename FromDataType::FieldType;
137
103
                using ToFieldType = typename ToDataType::FieldType;
138
103
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
103
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
103
                UInt32 to_max_digits = 0;
150
103
                UInt32 to_precision = 0;
151
103
                UInt32 to_scale = 0;
152
153
103
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
103
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
103
                    const auto* to_decimal_type =
157
103
                            check_and_get_data_type<ToDataType>(to_type.get());
158
103
                    to_precision = to_decimal_type->get_precision();
159
103
                    ToDataType::check_type_precision(to_precision);
160
161
103
                    to_scale = to_decimal_type->get_scale();
162
103
                    ToDataType::check_type_scale(to_scale);
163
103
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
103
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
103
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
103
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
103
                if (to_scale > from_scale) {
174
66
                    multiply_may_overflow &=
175
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
66
                }
177
103
                return narrow_integral || multiply_may_overflow;
178
103
            }
179
0
            return false;
180
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
127
128
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
128
            using Types2 = std::decay_t<decltype(types2)>;
129
128
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
128
                using FromFieldType = typename FromDataType::FieldType;
137
128
                using ToFieldType = typename ToDataType::FieldType;
138
128
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
128
                UInt32 from_scale = 0;
140
141
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
128
                    const auto* from_decimal_type =
143
128
                            check_and_get_data_type<FromDataType>(from_type.get());
144
128
                    from_precision =
145
128
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
128
                    from_scale = from_decimal_type->get_scale();
147
128
                }
148
149
128
                UInt32 to_max_digits = 0;
150
128
                UInt32 to_precision = 0;
151
128
                UInt32 to_scale = 0;
152
153
128
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
128
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
128
                    const auto* to_decimal_type =
157
128
                            check_and_get_data_type<ToDataType>(to_type.get());
158
128
                    to_precision = to_decimal_type->get_precision();
159
128
                    ToDataType::check_type_precision(to_precision);
160
161
128
                    to_scale = to_decimal_type->get_scale();
162
128
                    ToDataType::check_type_scale(to_scale);
163
128
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
128
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
128
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
128
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
128
                if (to_scale > from_scale) {
174
62
                    multiply_may_overflow &=
175
62
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
62
                }
177
128
                return narrow_integral || multiply_may_overflow;
178
128
            }
179
0
            return false;
180
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
127
285
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
285
            using Types2 = std::decay_t<decltype(types2)>;
129
285
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
285
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
285
                using FromFieldType = typename FromDataType::FieldType;
137
285
                using ToFieldType = typename ToDataType::FieldType;
138
285
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
285
                UInt32 from_scale = 0;
140
141
285
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
285
                    const auto* from_decimal_type =
143
285
                            check_and_get_data_type<FromDataType>(from_type.get());
144
285
                    from_precision =
145
285
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
285
                    from_scale = from_decimal_type->get_scale();
147
285
                }
148
149
285
                UInt32 to_max_digits = 0;
150
285
                UInt32 to_precision = 0;
151
285
                UInt32 to_scale = 0;
152
153
285
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
285
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
285
                    const auto* to_decimal_type =
157
285
                            check_and_get_data_type<ToDataType>(to_type.get());
158
285
                    to_precision = to_decimal_type->get_precision();
159
285
                    ToDataType::check_type_precision(to_precision);
160
161
285
                    to_scale = to_decimal_type->get_scale();
162
285
                    ToDataType::check_type_scale(to_scale);
163
285
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
285
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
285
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
285
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
285
                if (to_scale > from_scale) {
174
78
                    multiply_may_overflow &=
175
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
78
                }
177
285
                return narrow_integral || multiply_may_overflow;
178
285
            }
179
0
            return false;
180
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
127
161
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
161
            using Types2 = std::decay_t<decltype(types2)>;
129
161
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
161
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
161
                using FromFieldType = typename FromDataType::FieldType;
137
161
                using ToFieldType = typename ToDataType::FieldType;
138
161
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
161
                UInt32 from_scale = 0;
140
141
161
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
161
                    const auto* from_decimal_type =
143
161
                            check_and_get_data_type<FromDataType>(from_type.get());
144
161
                    from_precision =
145
161
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
161
                    from_scale = from_decimal_type->get_scale();
147
161
                }
148
149
161
                UInt32 to_max_digits = 0;
150
161
                UInt32 to_precision = 0;
151
161
                UInt32 to_scale = 0;
152
153
161
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
161
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
161
                    const auto* to_decimal_type =
157
161
                            check_and_get_data_type<ToDataType>(to_type.get());
158
161
                    to_precision = to_decimal_type->get_precision();
159
161
                    ToDataType::check_type_precision(to_precision);
160
161
161
                    to_scale = to_decimal_type->get_scale();
162
161
                    ToDataType::check_type_scale(to_scale);
163
161
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
161
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
161
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
161
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
161
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
161
                return narrow_integral || multiply_may_overflow;
178
161
            }
179
0
            return false;
180
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
127
296
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
296
            using Types2 = std::decay_t<decltype(types2)>;
129
296
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
296
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
296
                using FromFieldType = typename FromDataType::FieldType;
137
296
                using ToFieldType = typename ToDataType::FieldType;
138
296
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
296
                UInt32 from_scale = 0;
140
141
296
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
296
                    const auto* from_decimal_type =
143
296
                            check_and_get_data_type<FromDataType>(from_type.get());
144
296
                    from_precision =
145
296
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
296
                    from_scale = from_decimal_type->get_scale();
147
296
                }
148
149
296
                UInt32 to_max_digits = 0;
150
296
                UInt32 to_precision = 0;
151
296
                UInt32 to_scale = 0;
152
153
296
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
296
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
296
                    const auto* to_decimal_type =
157
296
                            check_and_get_data_type<ToDataType>(to_type.get());
158
296
                    to_precision = to_decimal_type->get_precision();
159
296
                    ToDataType::check_type_precision(to_precision);
160
161
296
                    to_scale = to_decimal_type->get_scale();
162
296
                    ToDataType::check_type_scale(to_scale);
163
296
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
296
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
296
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
296
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
296
                if (to_scale > from_scale) {
174
78
                    multiply_may_overflow &=
175
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
78
                }
177
296
                return narrow_integral || multiply_may_overflow;
178
296
            }
179
0
            return false;
180
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
127
296
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
296
            using Types2 = std::decay_t<decltype(types2)>;
129
296
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
296
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
296
                using FromFieldType = typename FromDataType::FieldType;
137
296
                using ToFieldType = typename ToDataType::FieldType;
138
296
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
296
                UInt32 from_scale = 0;
140
141
296
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
296
                    const auto* from_decimal_type =
143
296
                            check_and_get_data_type<FromDataType>(from_type.get());
144
296
                    from_precision =
145
296
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
296
                    from_scale = from_decimal_type->get_scale();
147
296
                }
148
149
296
                UInt32 to_max_digits = 0;
150
296
                UInt32 to_precision = 0;
151
296
                UInt32 to_scale = 0;
152
153
296
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
296
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
296
                    const auto* to_decimal_type =
157
296
                            check_and_get_data_type<ToDataType>(to_type.get());
158
296
                    to_precision = to_decimal_type->get_precision();
159
296
                    ToDataType::check_type_precision(to_precision);
160
161
296
                    to_scale = to_decimal_type->get_scale();
162
296
                    ToDataType::check_type_scale(to_scale);
163
296
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
296
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
296
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
296
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
296
                if (to_scale > from_scale) {
174
78
                    multiply_may_overflow &=
175
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
78
                }
177
296
                return narrow_integral || multiply_may_overflow;
178
296
            }
179
0
            return false;
180
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
127
1.63k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.63k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.63k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.63k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.63k
                return false;
134
1.63k
            }
135
1.63k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.63k
                using FromFieldType = typename FromDataType::FieldType;
137
1.63k
                using ToFieldType = typename ToDataType::FieldType;
138
1.63k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.63k
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
1.63k
                UInt32 to_max_digits = 0;
150
1.63k
                UInt32 to_precision = 0;
151
1.63k
                UInt32 to_scale = 0;
152
153
1.63k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.63k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.63k
                    const auto* to_decimal_type =
157
1.63k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.63k
                    to_precision = to_decimal_type->get_precision();
159
1.63k
                    ToDataType::check_type_precision(to_precision);
160
161
1.63k
                    to_scale = to_decimal_type->get_scale();
162
1.63k
                    ToDataType::check_type_scale(to_scale);
163
1.63k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
1.63k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.63k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.63k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.63k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
1.63k
                return narrow_integral || multiply_may_overflow;
178
1.63k
            }
179
0
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7
                using FromFieldType = typename FromDataType::FieldType;
137
7
                using ToFieldType = typename ToDataType::FieldType;
138
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
7
                UInt32 to_max_digits = 0;
150
7
                UInt32 to_precision = 0;
151
7
                UInt32 to_scale = 0;
152
153
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7
                    const auto* to_decimal_type =
157
7
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7
                    to_precision = to_decimal_type->get_precision();
159
7
                    ToDataType::check_type_precision(to_precision);
160
161
7
                    to_scale = to_decimal_type->get_scale();
162
7
                    ToDataType::check_type_scale(to_scale);
163
7
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7
                if (to_scale > from_scale) {
174
6
                    multiply_may_overflow &=
175
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
6
                }
177
7
                return narrow_integral || multiply_may_overflow;
178
7
            }
179
0
            return false;
180
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
127
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
29
            using Types2 = std::decay_t<decltype(types2)>;
129
29
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
29
                using FromFieldType = typename FromDataType::FieldType;
137
29
                using ToFieldType = typename ToDataType::FieldType;
138
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
29
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
29
                UInt32 to_max_digits = 0;
150
29
                UInt32 to_precision = 0;
151
29
                UInt32 to_scale = 0;
152
153
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
29
                    const auto* to_decimal_type =
157
29
                            check_and_get_data_type<ToDataType>(to_type.get());
158
29
                    to_precision = to_decimal_type->get_precision();
159
29
                    ToDataType::check_type_precision(to_precision);
160
161
29
                    to_scale = to_decimal_type->get_scale();
162
29
                    ToDataType::check_type_scale(to_scale);
163
29
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
29
                if (to_scale > from_scale) {
174
18
                    multiply_may_overflow &=
175
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
18
                }
177
29
                return narrow_integral || multiply_may_overflow;
178
29
            }
179
0
            return false;
180
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
127
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
29
            using Types2 = std::decay_t<decltype(types2)>;
129
29
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
29
                using FromFieldType = typename FromDataType::FieldType;
137
29
                using ToFieldType = typename ToDataType::FieldType;
138
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
29
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
29
                UInt32 to_max_digits = 0;
150
29
                UInt32 to_precision = 0;
151
29
                UInt32 to_scale = 0;
152
153
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
29
                    const auto* to_decimal_type =
157
29
                            check_and_get_data_type<ToDataType>(to_type.get());
158
29
                    to_precision = to_decimal_type->get_precision();
159
29
                    ToDataType::check_type_precision(to_precision);
160
161
29
                    to_scale = to_decimal_type->get_scale();
162
29
                    ToDataType::check_type_scale(to_scale);
163
29
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
29
                if (to_scale > from_scale) {
174
18
                    multiply_may_overflow &=
175
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
18
                }
177
29
                return narrow_integral || multiply_may_overflow;
178
29
            }
179
0
            return false;
180
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
127
44
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
44
            using Types2 = std::decay_t<decltype(types2)>;
129
44
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
44
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
44
                using FromFieldType = typename FromDataType::FieldType;
137
44
                using ToFieldType = typename ToDataType::FieldType;
138
44
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
44
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
44
                UInt32 to_max_digits = 0;
150
44
                UInt32 to_precision = 0;
151
44
                UInt32 to_scale = 0;
152
153
44
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
44
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
44
                    const auto* to_decimal_type =
157
44
                            check_and_get_data_type<ToDataType>(to_type.get());
158
44
                    to_precision = to_decimal_type->get_precision();
159
44
                    ToDataType::check_type_precision(to_precision);
160
161
44
                    to_scale = to_decimal_type->get_scale();
162
44
                    ToDataType::check_type_scale(to_scale);
163
44
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
44
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
44
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
44
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
44
                if (to_scale > from_scale) {
174
28
                    multiply_may_overflow &=
175
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
28
                }
177
44
                return narrow_integral || multiply_may_overflow;
178
44
            }
179
0
            return false;
180
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
127
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
49
            using Types2 = std::decay_t<decltype(types2)>;
129
49
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
49
                using FromFieldType = typename FromDataType::FieldType;
137
49
                using ToFieldType = typename ToDataType::FieldType;
138
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
49
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
49
                UInt32 to_max_digits = 0;
150
49
                UInt32 to_precision = 0;
151
49
                UInt32 to_scale = 0;
152
153
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
49
                    const auto* to_decimal_type =
157
49
                            check_and_get_data_type<ToDataType>(to_type.get());
158
49
                    to_precision = to_decimal_type->get_precision();
159
49
                    ToDataType::check_type_precision(to_precision);
160
161
49
                    to_scale = to_decimal_type->get_scale();
162
49
                    ToDataType::check_type_scale(to_scale);
163
49
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
49
                if (to_scale > from_scale) {
174
28
                    multiply_may_overflow &=
175
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
28
                }
177
49
                return narrow_integral || multiply_may_overflow;
178
49
            }
179
0
            return false;
180
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
127
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
49
            using Types2 = std::decay_t<decltype(types2)>;
129
49
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
49
                using FromFieldType = typename FromDataType::FieldType;
137
49
                using ToFieldType = typename ToDataType::FieldType;
138
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
49
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
49
                UInt32 to_max_digits = 0;
150
49
                UInt32 to_precision = 0;
151
49
                UInt32 to_scale = 0;
152
153
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
49
                    const auto* to_decimal_type =
157
49
                            check_and_get_data_type<ToDataType>(to_type.get());
158
49
                    to_precision = to_decimal_type->get_precision();
159
49
                    ToDataType::check_type_precision(to_precision);
160
161
49
                    to_scale = to_decimal_type->get_scale();
162
49
                    ToDataType::check_type_scale(to_scale);
163
49
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
49
                if (to_scale > from_scale) {
174
28
                    multiply_may_overflow &=
175
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
28
                }
177
49
                return narrow_integral || multiply_may_overflow;
178
49
            }
179
0
            return false;
180
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
127
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
99
            using Types2 = std::decay_t<decltype(types2)>;
129
99
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
99
                using FromFieldType = typename FromDataType::FieldType;
137
99
                using ToFieldType = typename ToDataType::FieldType;
138
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
99
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
99
                UInt32 to_max_digits = 0;
150
99
                UInt32 to_precision = 0;
151
99
                UInt32 to_scale = 0;
152
153
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
99
                    const auto* to_decimal_type =
157
99
                            check_and_get_data_type<ToDataType>(to_type.get());
158
99
                    to_precision = to_decimal_type->get_precision();
159
99
                    ToDataType::check_type_precision(to_precision);
160
161
99
                    to_scale = to_decimal_type->get_scale();
162
99
                    ToDataType::check_type_scale(to_scale);
163
99
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
99
                if (to_scale > from_scale) {
174
58
                    multiply_may_overflow &=
175
58
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
58
                }
177
99
                return narrow_integral || multiply_may_overflow;
178
99
            }
179
0
            return false;
180
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
127
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
99
            using Types2 = std::decay_t<decltype(types2)>;
129
99
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
99
                using FromFieldType = typename FromDataType::FieldType;
137
99
                using ToFieldType = typename ToDataType::FieldType;
138
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
99
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
99
                UInt32 to_max_digits = 0;
150
99
                UInt32 to_precision = 0;
151
99
                UInt32 to_scale = 0;
152
153
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
99
                    const auto* to_decimal_type =
157
99
                            check_and_get_data_type<ToDataType>(to_type.get());
158
99
                    to_precision = to_decimal_type->get_precision();
159
99
                    ToDataType::check_type_precision(to_precision);
160
161
99
                    to_scale = to_decimal_type->get_scale();
162
99
                    ToDataType::check_type_scale(to_scale);
163
99
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
99
                if (to_scale > from_scale) {
174
66
                    multiply_may_overflow &=
175
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
66
                }
177
99
                return narrow_integral || multiply_may_overflow;
178
99
            }
179
0
            return false;
180
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
127
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
168
            using Types2 = std::decay_t<decltype(types2)>;
129
168
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
168
                using FromFieldType = typename FromDataType::FieldType;
137
168
                using ToFieldType = typename ToDataType::FieldType;
138
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
168
                UInt32 from_scale = 0;
140
141
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
168
                    const auto* from_decimal_type =
143
168
                            check_and_get_data_type<FromDataType>(from_type.get());
144
168
                    from_precision =
145
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
168
                    from_scale = from_decimal_type->get_scale();
147
168
                }
148
149
168
                UInt32 to_max_digits = 0;
150
168
                UInt32 to_precision = 0;
151
168
                UInt32 to_scale = 0;
152
153
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
168
                    const auto* to_decimal_type =
157
168
                            check_and_get_data_type<ToDataType>(to_type.get());
158
168
                    to_precision = to_decimal_type->get_precision();
159
168
                    ToDataType::check_type_precision(to_precision);
160
161
168
                    to_scale = to_decimal_type->get_scale();
162
168
                    ToDataType::check_type_scale(to_scale);
163
168
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
168
                if (to_scale > from_scale) {
174
105
                    multiply_may_overflow &=
175
105
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
105
                }
177
168
                return narrow_integral || multiply_may_overflow;
178
168
            }
179
0
            return false;
180
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
127
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
272
            using Types2 = std::decay_t<decltype(types2)>;
129
272
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
272
                using FromFieldType = typename FromDataType::FieldType;
137
272
                using ToFieldType = typename ToDataType::FieldType;
138
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
272
                UInt32 from_scale = 0;
140
141
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
272
                    const auto* from_decimal_type =
143
272
                            check_and_get_data_type<FromDataType>(from_type.get());
144
272
                    from_precision =
145
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
272
                    from_scale = from_decimal_type->get_scale();
147
272
                }
148
149
272
                UInt32 to_max_digits = 0;
150
272
                UInt32 to_precision = 0;
151
272
                UInt32 to_scale = 0;
152
153
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
272
                    const auto* to_decimal_type =
157
272
                            check_and_get_data_type<ToDataType>(to_type.get());
158
272
                    to_precision = to_decimal_type->get_precision();
159
272
                    ToDataType::check_type_precision(to_precision);
160
161
272
                    to_scale = to_decimal_type->get_scale();
162
272
                    ToDataType::check_type_scale(to_scale);
163
272
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
272
                if (to_scale > from_scale) {
174
152
                    multiply_may_overflow &=
175
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
152
                }
177
272
                return narrow_integral || multiply_may_overflow;
178
272
            }
179
0
            return false;
180
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
127
180
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
180
            using Types2 = std::decay_t<decltype(types2)>;
129
180
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
180
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
180
                using FromFieldType = typename FromDataType::FieldType;
137
180
                using ToFieldType = typename ToDataType::FieldType;
138
180
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
180
                UInt32 from_scale = 0;
140
141
180
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
180
                    const auto* from_decimal_type =
143
180
                            check_and_get_data_type<FromDataType>(from_type.get());
144
180
                    from_precision =
145
180
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
180
                    from_scale = from_decimal_type->get_scale();
147
180
                }
148
149
180
                UInt32 to_max_digits = 0;
150
180
                UInt32 to_precision = 0;
151
180
                UInt32 to_scale = 0;
152
153
180
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
180
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
180
                    const auto* to_decimal_type =
157
180
                            check_and_get_data_type<ToDataType>(to_type.get());
158
180
                    to_precision = to_decimal_type->get_precision();
159
180
                    ToDataType::check_type_precision(to_precision);
160
161
180
                    to_scale = to_decimal_type->get_scale();
162
180
                    ToDataType::check_type_scale(to_scale);
163
180
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
180
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
180
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
180
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
180
                if (to_scale > from_scale) {
174
50
                    multiply_may_overflow &=
175
50
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
50
                }
177
180
                return narrow_integral || multiply_may_overflow;
178
180
            }
179
0
            return false;
180
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
127
381
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
381
            using Types2 = std::decay_t<decltype(types2)>;
129
381
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
381
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
381
                using FromFieldType = typename FromDataType::FieldType;
137
381
                using ToFieldType = typename ToDataType::FieldType;
138
381
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
381
                UInt32 from_scale = 0;
140
141
381
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
381
                    const auto* from_decimal_type =
143
381
                            check_and_get_data_type<FromDataType>(from_type.get());
144
381
                    from_precision =
145
381
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
381
                    from_scale = from_decimal_type->get_scale();
147
381
                }
148
149
381
                UInt32 to_max_digits = 0;
150
381
                UInt32 to_precision = 0;
151
381
                UInt32 to_scale = 0;
152
153
381
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
381
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
381
                    const auto* to_decimal_type =
157
381
                            check_and_get_data_type<ToDataType>(to_type.get());
158
381
                    to_precision = to_decimal_type->get_precision();
159
381
                    ToDataType::check_type_precision(to_precision);
160
161
381
                    to_scale = to_decimal_type->get_scale();
162
381
                    ToDataType::check_type_scale(to_scale);
163
381
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
381
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
381
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
381
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
381
                if (to_scale > from_scale) {
174
136
                    multiply_may_overflow &=
175
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
136
                }
177
381
                return narrow_integral || multiply_may_overflow;
178
381
            }
179
0
            return false;
180
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
127
392
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
392
            using Types2 = std::decay_t<decltype(types2)>;
129
392
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
392
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
392
                using FromFieldType = typename FromDataType::FieldType;
137
392
                using ToFieldType = typename ToDataType::FieldType;
138
392
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
392
                UInt32 from_scale = 0;
140
141
392
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
392
                    const auto* from_decimal_type =
143
392
                            check_and_get_data_type<FromDataType>(from_type.get());
144
392
                    from_precision =
145
392
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
392
                    from_scale = from_decimal_type->get_scale();
147
392
                }
148
149
392
                UInt32 to_max_digits = 0;
150
392
                UInt32 to_precision = 0;
151
392
                UInt32 to_scale = 0;
152
153
392
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
392
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
392
                    const auto* to_decimal_type =
157
392
                            check_and_get_data_type<ToDataType>(to_type.get());
158
392
                    to_precision = to_decimal_type->get_precision();
159
392
                    ToDataType::check_type_precision(to_precision);
160
161
392
                    to_scale = to_decimal_type->get_scale();
162
392
                    ToDataType::check_type_scale(to_scale);
163
392
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
392
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
392
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
392
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
392
                if (to_scale > from_scale) {
174
136
                    multiply_may_overflow &=
175
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
136
                }
177
392
                return narrow_integral || multiply_may_overflow;
178
392
            }
179
0
            return false;
180
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
127
1.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.41k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.41k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.41k
                return false;
134
1.41k
            }
135
1.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.41k
                using FromFieldType = typename FromDataType::FieldType;
137
1.41k
                using ToFieldType = typename ToDataType::FieldType;
138
1.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.41k
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
1.41k
                UInt32 to_max_digits = 0;
150
1.41k
                UInt32 to_precision = 0;
151
1.41k
                UInt32 to_scale = 0;
152
153
1.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.41k
                    const auto* to_decimal_type =
157
1.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.41k
                    to_precision = to_decimal_type->get_precision();
159
1.41k
                    ToDataType::check_type_precision(to_precision);
160
161
1.41k
                    to_scale = to_decimal_type->get_scale();
162
1.41k
                    ToDataType::check_type_scale(to_scale);
163
1.41k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
1.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.41k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
1.41k
                return narrow_integral || multiply_may_overflow;
178
1.41k
            }
179
0
            return false;
180
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
127
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4
            using Types2 = std::decay_t<decltype(types2)>;
129
4
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
4
                using FromFieldType = typename FromDataType::FieldType;
137
4
                using ToFieldType = typename ToDataType::FieldType;
138
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
4
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
4
                UInt32 to_max_digits = 0;
150
4
                UInt32 to_precision = 0;
151
4
                UInt32 to_scale = 0;
152
153
4
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
4
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
4
                    const auto* to_decimal_type =
157
4
                            check_and_get_data_type<ToDataType>(to_type.get());
158
4
                    to_precision = to_decimal_type->get_precision();
159
4
                    ToDataType::check_type_precision(to_precision);
160
161
4
                    to_scale = to_decimal_type->get_scale();
162
4
                    ToDataType::check_type_scale(to_scale);
163
4
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
4
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
4
                if (to_scale > from_scale) {
174
4
                    multiply_may_overflow &=
175
4
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
4
                }
177
4
                return narrow_integral || multiply_may_overflow;
178
4
            }
179
0
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7
                using FromFieldType = typename FromDataType::FieldType;
137
7
                using ToFieldType = typename ToDataType::FieldType;
138
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
7
                UInt32 to_max_digits = 0;
150
7
                UInt32 to_precision = 0;
151
7
                UInt32 to_scale = 0;
152
153
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7
                    const auto* to_decimal_type =
157
7
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7
                    to_precision = to_decimal_type->get_precision();
159
7
                    ToDataType::check_type_precision(to_precision);
160
161
7
                    to_scale = to_decimal_type->get_scale();
162
7
                    ToDataType::check_type_scale(to_scale);
163
7
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7
                if (to_scale > from_scale) {
174
6
                    multiply_may_overflow &=
175
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
6
                }
177
7
                return narrow_integral || multiply_may_overflow;
178
7
            }
179
0
            return false;
180
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
127
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
29
            using Types2 = std::decay_t<decltype(types2)>;
129
29
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
29
                using FromFieldType = typename FromDataType::FieldType;
137
29
                using ToFieldType = typename ToDataType::FieldType;
138
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
29
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
29
                UInt32 to_max_digits = 0;
150
29
                UInt32 to_precision = 0;
151
29
                UInt32 to_scale = 0;
152
153
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
29
                    const auto* to_decimal_type =
157
29
                            check_and_get_data_type<ToDataType>(to_type.get());
158
29
                    to_precision = to_decimal_type->get_precision();
159
29
                    ToDataType::check_type_precision(to_precision);
160
161
29
                    to_scale = to_decimal_type->get_scale();
162
29
                    ToDataType::check_type_scale(to_scale);
163
29
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
29
                if (to_scale > from_scale) {
174
18
                    multiply_may_overflow &=
175
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
18
                }
177
29
                return narrow_integral || multiply_may_overflow;
178
29
            }
179
0
            return false;
180
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
127
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
29
            using Types2 = std::decay_t<decltype(types2)>;
129
29
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
29
                using FromFieldType = typename FromDataType::FieldType;
137
29
                using ToFieldType = typename ToDataType::FieldType;
138
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
29
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
29
                UInt32 to_max_digits = 0;
150
29
                UInt32 to_precision = 0;
151
29
                UInt32 to_scale = 0;
152
153
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
29
                    const auto* to_decimal_type =
157
29
                            check_and_get_data_type<ToDataType>(to_type.get());
158
29
                    to_precision = to_decimal_type->get_precision();
159
29
                    ToDataType::check_type_precision(to_precision);
160
161
29
                    to_scale = to_decimal_type->get_scale();
162
29
                    ToDataType::check_type_scale(to_scale);
163
29
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
29
                if (to_scale > from_scale) {
174
18
                    multiply_may_overflow &=
175
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
18
                }
177
29
                return narrow_integral || multiply_may_overflow;
178
29
            }
179
0
            return false;
180
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
127
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
29
            using Types2 = std::decay_t<decltype(types2)>;
129
29
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
29
                using FromFieldType = typename FromDataType::FieldType;
137
29
                using ToFieldType = typename ToDataType::FieldType;
138
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
29
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
29
                UInt32 to_max_digits = 0;
150
29
                UInt32 to_precision = 0;
151
29
                UInt32 to_scale = 0;
152
153
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
29
                    const auto* to_decimal_type =
157
29
                            check_and_get_data_type<ToDataType>(to_type.get());
158
29
                    to_precision = to_decimal_type->get_precision();
159
29
                    ToDataType::check_type_precision(to_precision);
160
161
29
                    to_scale = to_decimal_type->get_scale();
162
29
                    ToDataType::check_type_scale(to_scale);
163
29
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
29
                if (to_scale > from_scale) {
174
18
                    multiply_may_overflow &=
175
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
18
                }
177
29
                return narrow_integral || multiply_may_overflow;
178
29
            }
179
0
            return false;
180
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
127
34
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
34
            using Types2 = std::decay_t<decltype(types2)>;
129
34
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
34
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
34
                using FromFieldType = typename FromDataType::FieldType;
137
34
                using ToFieldType = typename ToDataType::FieldType;
138
34
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
34
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
34
                UInt32 to_max_digits = 0;
150
34
                UInt32 to_precision = 0;
151
34
                UInt32 to_scale = 0;
152
153
34
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
34
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
34
                    const auto* to_decimal_type =
157
34
                            check_and_get_data_type<ToDataType>(to_type.get());
158
34
                    to_precision = to_decimal_type->get_precision();
159
34
                    ToDataType::check_type_precision(to_precision);
160
161
34
                    to_scale = to_decimal_type->get_scale();
162
34
                    ToDataType::check_type_scale(to_scale);
163
34
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
34
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
34
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
34
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
34
                if (to_scale > from_scale) {
174
23
                    multiply_may_overflow &=
175
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
23
                }
177
34
                return narrow_integral || multiply_may_overflow;
178
34
            }
179
0
            return false;
180
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
127
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
49
            using Types2 = std::decay_t<decltype(types2)>;
129
49
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
49
                using FromFieldType = typename FromDataType::FieldType;
137
49
                using ToFieldType = typename ToDataType::FieldType;
138
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
49
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
49
                UInt32 to_max_digits = 0;
150
49
                UInt32 to_precision = 0;
151
49
                UInt32 to_scale = 0;
152
153
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
49
                    const auto* to_decimal_type =
157
49
                            check_and_get_data_type<ToDataType>(to_type.get());
158
49
                    to_precision = to_decimal_type->get_precision();
159
49
                    ToDataType::check_type_precision(to_precision);
160
161
49
                    to_scale = to_decimal_type->get_scale();
162
49
                    ToDataType::check_type_scale(to_scale);
163
49
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
49
                if (to_scale > from_scale) {
174
28
                    multiply_may_overflow &=
175
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
28
                }
177
49
                return narrow_integral || multiply_may_overflow;
178
49
            }
179
0
            return false;
180
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
127
107
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
107
            using Types2 = std::decay_t<decltype(types2)>;
129
107
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
107
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
107
                using FromFieldType = typename FromDataType::FieldType;
137
107
                using ToFieldType = typename ToDataType::FieldType;
138
107
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
107
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
107
                UInt32 to_max_digits = 0;
150
107
                UInt32 to_precision = 0;
151
107
                UInt32 to_scale = 0;
152
153
107
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
107
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
107
                    const auto* to_decimal_type =
157
107
                            check_and_get_data_type<ToDataType>(to_type.get());
158
107
                    to_precision = to_decimal_type->get_precision();
159
107
                    ToDataType::check_type_precision(to_precision);
160
161
107
                    to_scale = to_decimal_type->get_scale();
162
107
                    ToDataType::check_type_scale(to_scale);
163
107
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
107
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
107
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
107
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
107
                if (to_scale > from_scale) {
174
66
                    multiply_may_overflow &=
175
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
66
                }
177
107
                return narrow_integral || multiply_may_overflow;
178
107
            }
179
0
            return false;
180
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
127
91
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
91
            using Types2 = std::decay_t<decltype(types2)>;
129
91
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
91
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
91
                using FromFieldType = typename FromDataType::FieldType;
137
91
                using ToFieldType = typename ToDataType::FieldType;
138
91
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
91
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
91
                UInt32 to_max_digits = 0;
150
91
                UInt32 to_precision = 0;
151
91
                UInt32 to_scale = 0;
152
153
91
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
91
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
91
                    const auto* to_decimal_type =
157
91
                            check_and_get_data_type<ToDataType>(to_type.get());
158
91
                    to_precision = to_decimal_type->get_precision();
159
91
                    ToDataType::check_type_precision(to_precision);
160
161
91
                    to_scale = to_decimal_type->get_scale();
162
91
                    ToDataType::check_type_scale(to_scale);
163
91
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
91
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
91
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
91
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
91
                if (to_scale > from_scale) {
174
58
                    multiply_may_overflow &=
175
58
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
58
                }
177
91
                return narrow_integral || multiply_may_overflow;
178
91
            }
179
0
            return false;
180
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
127
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
168
            using Types2 = std::decay_t<decltype(types2)>;
129
168
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
168
                using FromFieldType = typename FromDataType::FieldType;
137
168
                using ToFieldType = typename ToDataType::FieldType;
138
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
168
                UInt32 from_scale = 0;
140
141
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
168
                    const auto* from_decimal_type =
143
168
                            check_and_get_data_type<FromDataType>(from_type.get());
144
168
                    from_precision =
145
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
168
                    from_scale = from_decimal_type->get_scale();
147
168
                }
148
149
168
                UInt32 to_max_digits = 0;
150
168
                UInt32 to_precision = 0;
151
168
                UInt32 to_scale = 0;
152
153
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
168
                    const auto* to_decimal_type =
157
168
                            check_and_get_data_type<ToDataType>(to_type.get());
158
168
                    to_precision = to_decimal_type->get_precision();
159
168
                    ToDataType::check_type_precision(to_precision);
160
161
168
                    to_scale = to_decimal_type->get_scale();
162
168
                    ToDataType::check_type_scale(to_scale);
163
168
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
168
                if (to_scale > from_scale) {
174
106
                    multiply_may_overflow &=
175
106
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
106
                }
177
168
                return narrow_integral || multiply_may_overflow;
178
168
            }
179
0
            return false;
180
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
127
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
264
            using Types2 = std::decay_t<decltype(types2)>;
129
264
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
264
                using FromFieldType = typename FromDataType::FieldType;
137
264
                using ToFieldType = typename ToDataType::FieldType;
138
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
264
                UInt32 from_scale = 0;
140
141
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
264
                    const auto* from_decimal_type =
143
264
                            check_and_get_data_type<FromDataType>(from_type.get());
144
264
                    from_precision =
145
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
264
                    from_scale = from_decimal_type->get_scale();
147
264
                }
148
149
264
                UInt32 to_max_digits = 0;
150
264
                UInt32 to_precision = 0;
151
264
                UInt32 to_scale = 0;
152
153
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
264
                    const auto* to_decimal_type =
157
264
                            check_and_get_data_type<ToDataType>(to_type.get());
158
264
                    to_precision = to_decimal_type->get_precision();
159
264
                    ToDataType::check_type_precision(to_precision);
160
161
264
                    to_scale = to_decimal_type->get_scale();
162
264
                    ToDataType::check_type_scale(to_scale);
163
264
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
264
                if (to_scale > from_scale) {
174
159
                    multiply_may_overflow &=
175
159
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
159
                }
177
264
                return narrow_integral || multiply_may_overflow;
178
264
            }
179
0
            return false;
180
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
127
135
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
135
            using Types2 = std::decay_t<decltype(types2)>;
129
135
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
135
                using FromFieldType = typename FromDataType::FieldType;
137
135
                using ToFieldType = typename ToDataType::FieldType;
138
135
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
135
                UInt32 from_scale = 0;
140
141
135
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
135
                    const auto* from_decimal_type =
143
135
                            check_and_get_data_type<FromDataType>(from_type.get());
144
135
                    from_precision =
145
135
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
135
                    from_scale = from_decimal_type->get_scale();
147
135
                }
148
149
135
                UInt32 to_max_digits = 0;
150
135
                UInt32 to_precision = 0;
151
135
                UInt32 to_scale = 0;
152
153
135
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
135
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
135
                    const auto* to_decimal_type =
157
135
                            check_and_get_data_type<ToDataType>(to_type.get());
158
135
                    to_precision = to_decimal_type->get_precision();
159
135
                    ToDataType::check_type_precision(to_precision);
160
161
135
                    to_scale = to_decimal_type->get_scale();
162
135
                    ToDataType::check_type_scale(to_scale);
163
135
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
135
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
135
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
135
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
135
                if (to_scale > from_scale) {
174
68
                    multiply_may_overflow &=
175
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
68
                }
177
135
                return narrow_integral || multiply_may_overflow;
178
135
            }
179
0
            return false;
180
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
127
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
272
            using Types2 = std::decay_t<decltype(types2)>;
129
272
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
272
                using FromFieldType = typename FromDataType::FieldType;
137
272
                using ToFieldType = typename ToDataType::FieldType;
138
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
272
                UInt32 from_scale = 0;
140
141
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
272
                    const auto* from_decimal_type =
143
272
                            check_and_get_data_type<FromDataType>(from_type.get());
144
272
                    from_precision =
145
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
272
                    from_scale = from_decimal_type->get_scale();
147
272
                }
148
149
272
                UInt32 to_max_digits = 0;
150
272
                UInt32 to_precision = 0;
151
272
                UInt32 to_scale = 0;
152
153
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
272
                    const auto* to_decimal_type =
157
272
                            check_and_get_data_type<ToDataType>(to_type.get());
158
272
                    to_precision = to_decimal_type->get_precision();
159
272
                    ToDataType::check_type_precision(to_precision);
160
161
272
                    to_scale = to_decimal_type->get_scale();
162
272
                    ToDataType::check_type_scale(to_scale);
163
272
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
272
                if (to_scale > from_scale) {
174
152
                    multiply_may_overflow &=
175
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
152
                }
177
272
                return narrow_integral || multiply_may_overflow;
178
272
            }
179
0
            return false;
180
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
127
381
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
381
            using Types2 = std::decay_t<decltype(types2)>;
129
381
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
381
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
381
                using FromFieldType = typename FromDataType::FieldType;
137
381
                using ToFieldType = typename ToDataType::FieldType;
138
381
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
381
                UInt32 from_scale = 0;
140
141
381
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
381
                    const auto* from_decimal_type =
143
381
                            check_and_get_data_type<FromDataType>(from_type.get());
144
381
                    from_precision =
145
381
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
381
                    from_scale = from_decimal_type->get_scale();
147
381
                }
148
149
381
                UInt32 to_max_digits = 0;
150
381
                UInt32 to_precision = 0;
151
381
                UInt32 to_scale = 0;
152
153
381
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
381
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
381
                    const auto* to_decimal_type =
157
381
                            check_and_get_data_type<ToDataType>(to_type.get());
158
381
                    to_precision = to_decimal_type->get_precision();
159
381
                    ToDataType::check_type_precision(to_precision);
160
161
381
                    to_scale = to_decimal_type->get_scale();
162
381
                    ToDataType::check_type_scale(to_scale);
163
381
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
381
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
381
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
381
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
381
                if (to_scale > from_scale) {
174
136
                    multiply_may_overflow &=
175
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
136
                }
177
381
                return narrow_integral || multiply_may_overflow;
178
381
            }
179
0
            return false;
180
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
127
1.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.41k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.41k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.41k
                return false;
134
1.41k
            }
135
1.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.41k
                using FromFieldType = typename FromDataType::FieldType;
137
1.41k
                using ToFieldType = typename ToDataType::FieldType;
138
1.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.41k
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
1.41k
                UInt32 to_max_digits = 0;
150
1.41k
                UInt32 to_precision = 0;
151
1.41k
                UInt32 to_scale = 0;
152
153
1.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.41k
                    const auto* to_decimal_type =
157
1.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.41k
                    to_precision = to_decimal_type->get_precision();
159
1.41k
                    ToDataType::check_type_precision(to_precision);
160
161
1.41k
                    to_scale = to_decimal_type->get_scale();
162
1.41k
                    ToDataType::check_type_scale(to_scale);
163
1.41k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
1.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.41k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
1.41k
                return narrow_integral || multiply_may_overflow;
178
1.41k
            }
179
0
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7
                using FromFieldType = typename FromDataType::FieldType;
137
7
                using ToFieldType = typename ToDataType::FieldType;
138
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
7
                UInt32 to_max_digits = 0;
150
7
                UInt32 to_precision = 0;
151
7
                UInt32 to_scale = 0;
152
153
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7
                    const auto* to_decimal_type =
157
7
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7
                    to_precision = to_decimal_type->get_precision();
159
7
                    ToDataType::check_type_precision(to_precision);
160
161
7
                    to_scale = to_decimal_type->get_scale();
162
7
                    ToDataType::check_type_scale(to_scale);
163
7
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7
                if (to_scale > from_scale) {
174
6
                    multiply_may_overflow &=
175
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
6
                }
177
7
                return narrow_integral || multiply_may_overflow;
178
7
            }
179
0
            return false;
180
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
127
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
29
            using Types2 = std::decay_t<decltype(types2)>;
129
29
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
29
                using FromFieldType = typename FromDataType::FieldType;
137
29
                using ToFieldType = typename ToDataType::FieldType;
138
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
29
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
29
                UInt32 to_max_digits = 0;
150
29
                UInt32 to_precision = 0;
151
29
                UInt32 to_scale = 0;
152
153
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
29
                    const auto* to_decimal_type =
157
29
                            check_and_get_data_type<ToDataType>(to_type.get());
158
29
                    to_precision = to_decimal_type->get_precision();
159
29
                    ToDataType::check_type_precision(to_precision);
160
161
29
                    to_scale = to_decimal_type->get_scale();
162
29
                    ToDataType::check_type_scale(to_scale);
163
29
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
29
                if (to_scale > from_scale) {
174
18
                    multiply_may_overflow &=
175
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
18
                }
177
29
                return narrow_integral || multiply_may_overflow;
178
29
            }
179
0
            return false;
180
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
127
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
29
            using Types2 = std::decay_t<decltype(types2)>;
129
29
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
29
                using FromFieldType = typename FromDataType::FieldType;
137
29
                using ToFieldType = typename ToDataType::FieldType;
138
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
29
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
29
                UInt32 to_max_digits = 0;
150
29
                UInt32 to_precision = 0;
151
29
                UInt32 to_scale = 0;
152
153
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
29
                    const auto* to_decimal_type =
157
29
                            check_and_get_data_type<ToDataType>(to_type.get());
158
29
                    to_precision = to_decimal_type->get_precision();
159
29
                    ToDataType::check_type_precision(to_precision);
160
161
29
                    to_scale = to_decimal_type->get_scale();
162
29
                    ToDataType::check_type_scale(to_scale);
163
29
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
29
                if (to_scale > from_scale) {
174
18
                    multiply_may_overflow &=
175
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
18
                }
177
29
                return narrow_integral || multiply_may_overflow;
178
29
            }
179
0
            return false;
180
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
127
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
29
            using Types2 = std::decay_t<decltype(types2)>;
129
29
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
29
                using FromFieldType = typename FromDataType::FieldType;
137
29
                using ToFieldType = typename ToDataType::FieldType;
138
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
29
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
29
                UInt32 to_max_digits = 0;
150
29
                UInt32 to_precision = 0;
151
29
                UInt32 to_scale = 0;
152
153
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
29
                    const auto* to_decimal_type =
157
29
                            check_and_get_data_type<ToDataType>(to_type.get());
158
29
                    to_precision = to_decimal_type->get_precision();
159
29
                    ToDataType::check_type_precision(to_precision);
160
161
29
                    to_scale = to_decimal_type->get_scale();
162
29
                    ToDataType::check_type_scale(to_scale);
163
29
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
29
                if (to_scale > from_scale) {
174
18
                    multiply_may_overflow &=
175
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
18
                }
177
29
                return narrow_integral || multiply_may_overflow;
178
29
            }
179
0
            return false;
180
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
127
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
29
            using Types2 = std::decay_t<decltype(types2)>;
129
29
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
29
                using FromFieldType = typename FromDataType::FieldType;
137
29
                using ToFieldType = typename ToDataType::FieldType;
138
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
29
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
29
                UInt32 to_max_digits = 0;
150
29
                UInt32 to_precision = 0;
151
29
                UInt32 to_scale = 0;
152
153
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
29
                    const auto* to_decimal_type =
157
29
                            check_and_get_data_type<ToDataType>(to_type.get());
158
29
                    to_precision = to_decimal_type->get_precision();
159
29
                    ToDataType::check_type_precision(to_precision);
160
161
29
                    to_scale = to_decimal_type->get_scale();
162
29
                    ToDataType::check_type_scale(to_scale);
163
29
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
29
                if (to_scale > from_scale) {
174
18
                    multiply_may_overflow &=
175
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
18
                }
177
29
                return narrow_integral || multiply_may_overflow;
178
29
            }
179
0
            return false;
180
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
127
44
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
44
            using Types2 = std::decay_t<decltype(types2)>;
129
44
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
44
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
44
                using FromFieldType = typename FromDataType::FieldType;
137
44
                using ToFieldType = typename ToDataType::FieldType;
138
44
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
44
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
44
                UInt32 to_max_digits = 0;
150
44
                UInt32 to_precision = 0;
151
44
                UInt32 to_scale = 0;
152
153
44
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
44
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
44
                    const auto* to_decimal_type =
157
44
                            check_and_get_data_type<ToDataType>(to_type.get());
158
44
                    to_precision = to_decimal_type->get_precision();
159
44
                    ToDataType::check_type_precision(to_precision);
160
161
44
                    to_scale = to_decimal_type->get_scale();
162
44
                    ToDataType::check_type_scale(to_scale);
163
44
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
44
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
44
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
44
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
44
                if (to_scale > from_scale) {
174
28
                    multiply_may_overflow &=
175
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
28
                }
177
44
                return narrow_integral || multiply_may_overflow;
178
44
            }
179
0
            return false;
180
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
127
87
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
87
            using Types2 = std::decay_t<decltype(types2)>;
129
87
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
87
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
87
                using FromFieldType = typename FromDataType::FieldType;
137
87
                using ToFieldType = typename ToDataType::FieldType;
138
87
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
87
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
87
                UInt32 to_max_digits = 0;
150
87
                UInt32 to_precision = 0;
151
87
                UInt32 to_scale = 0;
152
153
87
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
87
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
87
                    const auto* to_decimal_type =
157
87
                            check_and_get_data_type<ToDataType>(to_type.get());
158
87
                    to_precision = to_decimal_type->get_precision();
159
87
                    ToDataType::check_type_precision(to_precision);
160
161
87
                    to_scale = to_decimal_type->get_scale();
162
87
                    ToDataType::check_type_scale(to_scale);
163
87
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
87
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
87
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
87
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
87
                if (to_scale > from_scale) {
174
66
                    multiply_may_overflow &=
175
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
66
                }
177
87
                return narrow_integral || multiply_may_overflow;
178
87
            }
179
0
            return false;
180
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
127
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
99
            using Types2 = std::decay_t<decltype(types2)>;
129
99
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
99
                using FromFieldType = typename FromDataType::FieldType;
137
99
                using ToFieldType = typename ToDataType::FieldType;
138
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
99
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
99
                UInt32 to_max_digits = 0;
150
99
                UInt32 to_precision = 0;
151
99
                UInt32 to_scale = 0;
152
153
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
99
                    const auto* to_decimal_type =
157
99
                            check_and_get_data_type<ToDataType>(to_type.get());
158
99
                    to_precision = to_decimal_type->get_precision();
159
99
                    ToDataType::check_type_precision(to_precision);
160
161
99
                    to_scale = to_decimal_type->get_scale();
162
99
                    ToDataType::check_type_scale(to_scale);
163
99
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
99
                if (to_scale > from_scale) {
174
66
                    multiply_may_overflow &=
175
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
66
                }
177
99
                return narrow_integral || multiply_may_overflow;
178
99
            }
179
0
            return false;
180
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
127
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
168
            using Types2 = std::decay_t<decltype(types2)>;
129
168
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
168
                using FromFieldType = typename FromDataType::FieldType;
137
168
                using ToFieldType = typename ToDataType::FieldType;
138
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
168
                UInt32 from_scale = 0;
140
141
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
168
                    const auto* from_decimal_type =
143
168
                            check_and_get_data_type<FromDataType>(from_type.get());
144
168
                    from_precision =
145
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
168
                    from_scale = from_decimal_type->get_scale();
147
168
                }
148
149
168
                UInt32 to_max_digits = 0;
150
168
                UInt32 to_precision = 0;
151
168
                UInt32 to_scale = 0;
152
153
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
168
                    const auto* to_decimal_type =
157
168
                            check_and_get_data_type<ToDataType>(to_type.get());
158
168
                    to_precision = to_decimal_type->get_precision();
159
168
                    ToDataType::check_type_precision(to_precision);
160
161
168
                    to_scale = to_decimal_type->get_scale();
162
168
                    ToDataType::check_type_scale(to_scale);
163
168
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
168
                if (to_scale > from_scale) {
174
106
                    multiply_may_overflow &=
175
106
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
106
                }
177
168
                return narrow_integral || multiply_may_overflow;
178
168
            }
179
0
            return false;
180
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
127
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
264
            using Types2 = std::decay_t<decltype(types2)>;
129
264
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
264
                using FromFieldType = typename FromDataType::FieldType;
137
264
                using ToFieldType = typename ToDataType::FieldType;
138
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
264
                UInt32 from_scale = 0;
140
141
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
264
                    const auto* from_decimal_type =
143
264
                            check_and_get_data_type<FromDataType>(from_type.get());
144
264
                    from_precision =
145
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
264
                    from_scale = from_decimal_type->get_scale();
147
264
                }
148
149
264
                UInt32 to_max_digits = 0;
150
264
                UInt32 to_precision = 0;
151
264
                UInt32 to_scale = 0;
152
153
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
264
                    const auto* to_decimal_type =
157
264
                            check_and_get_data_type<ToDataType>(to_type.get());
158
264
                    to_precision = to_decimal_type->get_precision();
159
264
                    ToDataType::check_type_precision(to_precision);
160
161
264
                    to_scale = to_decimal_type->get_scale();
162
264
                    ToDataType::check_type_scale(to_scale);
163
264
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
264
                if (to_scale > from_scale) {
174
160
                    multiply_may_overflow &=
175
160
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
160
                }
177
264
                return narrow_integral || multiply_may_overflow;
178
264
            }
179
0
            return false;
180
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
127
132
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
132
            using Types2 = std::decay_t<decltype(types2)>;
129
132
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
132
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
132
                using FromFieldType = typename FromDataType::FieldType;
137
132
                using ToFieldType = typename ToDataType::FieldType;
138
132
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
132
                UInt32 from_scale = 0;
140
141
132
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
132
                    const auto* from_decimal_type =
143
132
                            check_and_get_data_type<FromDataType>(from_type.get());
144
132
                    from_precision =
145
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
132
                    from_scale = from_decimal_type->get_scale();
147
132
                }
148
149
132
                UInt32 to_max_digits = 0;
150
132
                UInt32 to_precision = 0;
151
132
                UInt32 to_scale = 0;
152
153
132
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
132
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
132
                    const auto* to_decimal_type =
157
132
                            check_and_get_data_type<ToDataType>(to_type.get());
158
132
                    to_precision = to_decimal_type->get_precision();
159
132
                    ToDataType::check_type_precision(to_precision);
160
161
132
                    to_scale = to_decimal_type->get_scale();
162
132
                    ToDataType::check_type_scale(to_scale);
163
132
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
132
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
132
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
132
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
132
                if (to_scale > from_scale) {
174
68
                    multiply_may_overflow &=
175
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
68
                }
177
132
                return narrow_integral || multiply_may_overflow;
178
132
            }
179
0
            return false;
180
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
127
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
264
            using Types2 = std::decay_t<decltype(types2)>;
129
264
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
264
                using FromFieldType = typename FromDataType::FieldType;
137
264
                using ToFieldType = typename ToDataType::FieldType;
138
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
264
                UInt32 from_scale = 0;
140
141
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
264
                    const auto* from_decimal_type =
143
264
                            check_and_get_data_type<FromDataType>(from_type.get());
144
264
                    from_precision =
145
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
264
                    from_scale = from_decimal_type->get_scale();
147
264
                }
148
149
264
                UInt32 to_max_digits = 0;
150
264
                UInt32 to_precision = 0;
151
264
                UInt32 to_scale = 0;
152
153
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
264
                    const auto* to_decimal_type =
157
264
                            check_and_get_data_type<ToDataType>(to_type.get());
158
264
                    to_precision = to_decimal_type->get_precision();
159
264
                    ToDataType::check_type_precision(to_precision);
160
161
264
                    to_scale = to_decimal_type->get_scale();
162
264
                    ToDataType::check_type_scale(to_scale);
163
264
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
264
                if (to_scale > from_scale) {
174
159
                    multiply_may_overflow &=
175
159
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
159
                }
177
264
                return narrow_integral || multiply_may_overflow;
178
264
            }
179
0
            return false;
180
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
127
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
272
            using Types2 = std::decay_t<decltype(types2)>;
129
272
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
272
                using FromFieldType = typename FromDataType::FieldType;
137
272
                using ToFieldType = typename ToDataType::FieldType;
138
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
272
                UInt32 from_scale = 0;
140
141
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
272
                    const auto* from_decimal_type =
143
272
                            check_and_get_data_type<FromDataType>(from_type.get());
144
272
                    from_precision =
145
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
272
                    from_scale = from_decimal_type->get_scale();
147
272
                }
148
149
272
                UInt32 to_max_digits = 0;
150
272
                UInt32 to_precision = 0;
151
272
                UInt32 to_scale = 0;
152
153
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
272
                    const auto* to_decimal_type =
157
272
                            check_and_get_data_type<ToDataType>(to_type.get());
158
272
                    to_precision = to_decimal_type->get_precision();
159
272
                    ToDataType::check_type_precision(to_precision);
160
161
272
                    to_scale = to_decimal_type->get_scale();
162
272
                    ToDataType::check_type_scale(to_scale);
163
272
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
272
                if (to_scale > from_scale) {
174
152
                    multiply_may_overflow &=
175
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
152
                }
177
272
                return narrow_integral || multiply_may_overflow;
178
272
            }
179
0
            return false;
180
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
127
1.39k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.39k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.39k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.39k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.39k
                return false;
134
1.39k
            }
135
1.39k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.39k
                using FromFieldType = typename FromDataType::FieldType;
137
1.39k
                using ToFieldType = typename ToDataType::FieldType;
138
1.39k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.39k
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
1.39k
                UInt32 to_max_digits = 0;
150
1.39k
                UInt32 to_precision = 0;
151
1.39k
                UInt32 to_scale = 0;
152
153
1.39k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.39k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.39k
                    const auto* to_decimal_type =
157
1.39k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.39k
                    to_precision = to_decimal_type->get_precision();
159
1.39k
                    ToDataType::check_type_precision(to_precision);
160
161
1.39k
                    to_scale = to_decimal_type->get_scale();
162
1.39k
                    ToDataType::check_type_scale(to_scale);
163
1.39k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
1.39k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.39k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.39k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.39k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
1.39k
                return narrow_integral || multiply_may_overflow;
178
1.39k
            }
179
0
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2
                using FromFieldType = typename FromDataType::FieldType;
137
2
                using ToFieldType = typename ToDataType::FieldType;
138
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2
                UInt32 from_scale = 0;
140
141
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2
                    const auto* from_decimal_type =
143
2
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2
                    from_precision =
145
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2
                    from_scale = from_decimal_type->get_scale();
147
2
                }
148
149
2
                UInt32 to_max_digits = 0;
150
2
                UInt32 to_precision = 0;
151
2
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
2
                return narrow_integral || multiply_may_overflow;
178
2
            }
179
0
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
51
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
51
            using Types2 = std::decay_t<decltype(types2)>;
129
51
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
51
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
51
                return false;
134
51
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
51
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4
            using Types2 = std::decay_t<decltype(types2)>;
129
4
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
4
                using FromFieldType = typename FromDataType::FieldType;
137
4
                using ToFieldType = typename ToDataType::FieldType;
138
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
4
                UInt32 from_scale = 0;
140
141
4
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
4
                    const auto* from_decimal_type =
143
4
                            check_and_get_data_type<FromDataType>(from_type.get());
144
4
                    from_precision =
145
4
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
4
                    from_scale = from_decimal_type->get_scale();
147
4
                }
148
149
4
                UInt32 to_max_digits = 0;
150
4
                UInt32 to_precision = 0;
151
4
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
4
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
4
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
4
                return narrow_integral || multiply_may_overflow;
178
4
            }
179
0
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
50
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
50
            using Types2 = std::decay_t<decltype(types2)>;
129
50
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
50
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
50
                return false;
134
50
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
50
            return false;
180
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
127
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1
            using Types2 = std::decay_t<decltype(types2)>;
129
1
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1
            return false;
180
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
127
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1
            using Types2 = std::decay_t<decltype(types2)>;
129
1
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1
            return false;
180
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
127
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1
            using Types2 = std::decay_t<decltype(types2)>;
129
1
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1
                using FromFieldType = typename FromDataType::FieldType;
137
1
                using ToFieldType = typename ToDataType::FieldType;
138
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1
                UInt32 from_scale = 0;
140
141
1
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1
                    const auto* from_decimal_type =
143
1
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1
                    from_precision =
145
1
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1
                    from_scale = from_decimal_type->get_scale();
147
1
                }
148
149
1
                UInt32 to_max_digits = 0;
150
1
                UInt32 to_precision = 0;
151
1
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
1
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
1
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
1
                    to_precision = to_max_digits;
167
1
                }
168
169
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
1
                return narrow_integral || multiply_may_overflow;
178
1
            }
179
0
            return false;
180
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
127
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1
            using Types2 = std::decay_t<decltype(types2)>;
129
1
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1
            return false;
180
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
127
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
12
            using Types2 = std::decay_t<decltype(types2)>;
129
12
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
12
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
12
                return false;
134
12
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
12
            return false;
180
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_
181
35.2k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
117
48
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
48
        using Types = std::decay_t<decltype(types)>;
119
48
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
48
        return call_on_index_and_data_type<
127
48
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
48
            using Types2 = std::decay_t<decltype(types2)>;
129
48
            using FromDataType = typename Types2::LeftType;
130
48
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
48
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
48
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
48
                return false;
134
48
            }
135
48
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
48
                using FromFieldType = typename FromDataType::FieldType;
137
48
                using ToFieldType = typename ToDataType::FieldType;
138
48
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
48
                UInt32 from_scale = 0;
140
141
48
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
48
                    const auto* from_decimal_type =
143
48
                            check_and_get_data_type<FromDataType>(from_type.get());
144
48
                    from_precision =
145
48
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
48
                    from_scale = from_decimal_type->get_scale();
147
48
                }
148
149
48
                UInt32 to_max_digits = 0;
150
48
                UInt32 to_precision = 0;
151
48
                UInt32 to_scale = 0;
152
153
48
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
48
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
48
                    const auto* to_decimal_type =
157
48
                            check_and_get_data_type<ToDataType>(to_type.get());
158
48
                    to_precision = to_decimal_type->get_precision();
159
48
                    ToDataType::check_type_precision(to_precision);
160
161
48
                    to_scale = to_decimal_type->get_scale();
162
48
                    ToDataType::check_type_scale(to_scale);
163
48
                }
164
48
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
48
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
48
                    to_precision = to_max_digits;
167
48
                }
168
169
48
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
48
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
48
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
48
                if (to_scale > from_scale) {
174
48
                    multiply_may_overflow &=
175
48
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
48
                }
177
48
                return narrow_integral || multiply_may_overflow;
178
48
            }
179
48
            return false;
180
48
        });
181
48
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
117
1.44k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
1.44k
        using Types = std::decay_t<decltype(types)>;
119
1.44k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
1.44k
        return call_on_index_and_data_type<
127
1.44k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.44k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.44k
            using FromDataType = typename Types2::LeftType;
130
1.44k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
1.44k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.44k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.44k
                return false;
134
1.44k
            }
135
1.44k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.44k
                using FromFieldType = typename FromDataType::FieldType;
137
1.44k
                using ToFieldType = typename ToDataType::FieldType;
138
1.44k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.44k
                UInt32 from_scale = 0;
140
141
1.44k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.44k
                    const auto* from_decimal_type =
143
1.44k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.44k
                    from_precision =
145
1.44k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.44k
                    from_scale = from_decimal_type->get_scale();
147
1.44k
                }
148
149
1.44k
                UInt32 to_max_digits = 0;
150
1.44k
                UInt32 to_precision = 0;
151
1.44k
                UInt32 to_scale = 0;
152
153
1.44k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.44k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.44k
                    const auto* to_decimal_type =
157
1.44k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.44k
                    to_precision = to_decimal_type->get_precision();
159
1.44k
                    ToDataType::check_type_precision(to_precision);
160
161
1.44k
                    to_scale = to_decimal_type->get_scale();
162
1.44k
                    ToDataType::check_type_scale(to_scale);
163
1.44k
                }
164
1.44k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
1.44k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
1.44k
                    to_precision = to_max_digits;
167
1.44k
                }
168
169
1.44k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.44k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.44k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.44k
                if (to_scale > from_scale) {
174
1.44k
                    multiply_may_overflow &=
175
1.44k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
1.44k
                }
177
1.44k
                return narrow_integral || multiply_may_overflow;
178
1.44k
            }
179
1.44k
            return false;
180
1.44k
        });
181
1.44k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
117
1.42k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
1.42k
        using Types = std::decay_t<decltype(types)>;
119
1.42k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
1.42k
        return call_on_index_and_data_type<
127
1.42k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.42k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.42k
            using FromDataType = typename Types2::LeftType;
130
1.42k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
1.42k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.42k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.42k
                return false;
134
1.42k
            }
135
1.42k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.42k
                using FromFieldType = typename FromDataType::FieldType;
137
1.42k
                using ToFieldType = typename ToDataType::FieldType;
138
1.42k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.42k
                UInt32 from_scale = 0;
140
141
1.42k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.42k
                    const auto* from_decimal_type =
143
1.42k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.42k
                    from_precision =
145
1.42k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.42k
                    from_scale = from_decimal_type->get_scale();
147
1.42k
                }
148
149
1.42k
                UInt32 to_max_digits = 0;
150
1.42k
                UInt32 to_precision = 0;
151
1.42k
                UInt32 to_scale = 0;
152
153
1.42k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.42k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.42k
                    const auto* to_decimal_type =
157
1.42k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.42k
                    to_precision = to_decimal_type->get_precision();
159
1.42k
                    ToDataType::check_type_precision(to_precision);
160
161
1.42k
                    to_scale = to_decimal_type->get_scale();
162
1.42k
                    ToDataType::check_type_scale(to_scale);
163
1.42k
                }
164
1.42k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
1.42k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
1.42k
                    to_precision = to_max_digits;
167
1.42k
                }
168
169
1.42k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.42k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.42k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.42k
                if (to_scale > from_scale) {
174
1.42k
                    multiply_may_overflow &=
175
1.42k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
1.42k
                }
177
1.42k
                return narrow_integral || multiply_may_overflow;
178
1.42k
            }
179
1.42k
            return false;
180
1.42k
        });
181
1.42k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
117
1.28k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
1.28k
        using Types = std::decay_t<decltype(types)>;
119
1.28k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
1.28k
        return call_on_index_and_data_type<
127
1.28k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.28k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.28k
            using FromDataType = typename Types2::LeftType;
130
1.28k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
1.28k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.28k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.28k
                return false;
134
1.28k
            }
135
1.28k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.28k
                using FromFieldType = typename FromDataType::FieldType;
137
1.28k
                using ToFieldType = typename ToDataType::FieldType;
138
1.28k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.28k
                UInt32 from_scale = 0;
140
141
1.28k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.28k
                    const auto* from_decimal_type =
143
1.28k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.28k
                    from_precision =
145
1.28k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.28k
                    from_scale = from_decimal_type->get_scale();
147
1.28k
                }
148
149
1.28k
                UInt32 to_max_digits = 0;
150
1.28k
                UInt32 to_precision = 0;
151
1.28k
                UInt32 to_scale = 0;
152
153
1.28k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.28k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.28k
                    const auto* to_decimal_type =
157
1.28k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.28k
                    to_precision = to_decimal_type->get_precision();
159
1.28k
                    ToDataType::check_type_precision(to_precision);
160
161
1.28k
                    to_scale = to_decimal_type->get_scale();
162
1.28k
                    ToDataType::check_type_scale(to_scale);
163
1.28k
                }
164
1.28k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
1.28k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
1.28k
                    to_precision = to_max_digits;
167
1.28k
                }
168
169
1.28k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.28k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.28k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.28k
                if (to_scale > from_scale) {
174
1.28k
                    multiply_may_overflow &=
175
1.28k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
1.28k
                }
177
1.28k
                return narrow_integral || multiply_may_overflow;
178
1.28k
            }
179
1.28k
            return false;
180
1.28k
        });
181
1.28k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
117
1.03k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
1.03k
        using Types = std::decay_t<decltype(types)>;
119
1.03k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
1.03k
        return call_on_index_and_data_type<
127
1.03k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.03k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.03k
            using FromDataType = typename Types2::LeftType;
130
1.03k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
1.03k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.03k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.03k
                return false;
134
1.03k
            }
135
1.03k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.03k
                using FromFieldType = typename FromDataType::FieldType;
137
1.03k
                using ToFieldType = typename ToDataType::FieldType;
138
1.03k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.03k
                UInt32 from_scale = 0;
140
141
1.03k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.03k
                    const auto* from_decimal_type =
143
1.03k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.03k
                    from_precision =
145
1.03k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.03k
                    from_scale = from_decimal_type->get_scale();
147
1.03k
                }
148
149
1.03k
                UInt32 to_max_digits = 0;
150
1.03k
                UInt32 to_precision = 0;
151
1.03k
                UInt32 to_scale = 0;
152
153
1.03k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.03k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.03k
                    const auto* to_decimal_type =
157
1.03k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.03k
                    to_precision = to_decimal_type->get_precision();
159
1.03k
                    ToDataType::check_type_precision(to_precision);
160
161
1.03k
                    to_scale = to_decimal_type->get_scale();
162
1.03k
                    ToDataType::check_type_scale(to_scale);
163
1.03k
                }
164
1.03k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
1.03k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
1.03k
                    to_precision = to_max_digits;
167
1.03k
                }
168
169
1.03k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.03k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.03k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.03k
                if (to_scale > from_scale) {
174
1.03k
                    multiply_may_overflow &=
175
1.03k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
1.03k
                }
177
1.03k
                return narrow_integral || multiply_may_overflow;
178
1.03k
            }
179
1.03k
            return false;
180
1.03k
        });
181
1.03k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
117
1.10k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
1.10k
        using Types = std::decay_t<decltype(types)>;
119
1.10k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
1.10k
        return call_on_index_and_data_type<
127
1.10k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.10k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.10k
            using FromDataType = typename Types2::LeftType;
130
1.10k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
1.10k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.10k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.10k
                return false;
134
1.10k
            }
135
1.10k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.10k
                using FromFieldType = typename FromDataType::FieldType;
137
1.10k
                using ToFieldType = typename ToDataType::FieldType;
138
1.10k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.10k
                UInt32 from_scale = 0;
140
141
1.10k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.10k
                    const auto* from_decimal_type =
143
1.10k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.10k
                    from_precision =
145
1.10k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.10k
                    from_scale = from_decimal_type->get_scale();
147
1.10k
                }
148
149
1.10k
                UInt32 to_max_digits = 0;
150
1.10k
                UInt32 to_precision = 0;
151
1.10k
                UInt32 to_scale = 0;
152
153
1.10k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.10k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.10k
                    const auto* to_decimal_type =
157
1.10k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.10k
                    to_precision = to_decimal_type->get_precision();
159
1.10k
                    ToDataType::check_type_precision(to_precision);
160
161
1.10k
                    to_scale = to_decimal_type->get_scale();
162
1.10k
                    ToDataType::check_type_scale(to_scale);
163
1.10k
                }
164
1.10k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
1.10k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
1.10k
                    to_precision = to_max_digits;
167
1.10k
                }
168
169
1.10k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.10k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.10k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.10k
                if (to_scale > from_scale) {
174
1.10k
                    multiply_may_overflow &=
175
1.10k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
1.10k
                }
177
1.10k
                return narrow_integral || multiply_may_overflow;
178
1.10k
            }
179
1.10k
            return false;
180
1.10k
        });
181
1.10k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
117
8.17k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
8.17k
        using Types = std::decay_t<decltype(types)>;
119
8.17k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
8.17k
        return call_on_index_and_data_type<
127
8.17k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8.17k
            using Types2 = std::decay_t<decltype(types2)>;
129
8.17k
            using FromDataType = typename Types2::LeftType;
130
8.17k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
8.17k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
8.17k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
8.17k
                return false;
134
8.17k
            }
135
8.17k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
8.17k
                using FromFieldType = typename FromDataType::FieldType;
137
8.17k
                using ToFieldType = typename ToDataType::FieldType;
138
8.17k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
8.17k
                UInt32 from_scale = 0;
140
141
8.17k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
8.17k
                    const auto* from_decimal_type =
143
8.17k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
8.17k
                    from_precision =
145
8.17k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
8.17k
                    from_scale = from_decimal_type->get_scale();
147
8.17k
                }
148
149
8.17k
                UInt32 to_max_digits = 0;
150
8.17k
                UInt32 to_precision = 0;
151
8.17k
                UInt32 to_scale = 0;
152
153
8.17k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
8.17k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
8.17k
                    const auto* to_decimal_type =
157
8.17k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
8.17k
                    to_precision = to_decimal_type->get_precision();
159
8.17k
                    ToDataType::check_type_precision(to_precision);
160
161
8.17k
                    to_scale = to_decimal_type->get_scale();
162
8.17k
                    ToDataType::check_type_scale(to_scale);
163
8.17k
                }
164
8.17k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
8.17k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
8.17k
                    to_precision = to_max_digits;
167
8.17k
                }
168
169
8.17k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
8.17k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
8.17k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
8.17k
                if (to_scale > from_scale) {
174
8.17k
                    multiply_may_overflow &=
175
8.17k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
8.17k
                }
177
8.17k
                return narrow_integral || multiply_may_overflow;
178
8.17k
            }
179
8.17k
            return false;
180
8.17k
        });
181
8.17k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
117
8.25k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
8.25k
        using Types = std::decay_t<decltype(types)>;
119
8.25k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
8.25k
        return call_on_index_and_data_type<
127
8.25k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8.25k
            using Types2 = std::decay_t<decltype(types2)>;
129
8.25k
            using FromDataType = typename Types2::LeftType;
130
8.25k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
8.25k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
8.25k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
8.25k
                return false;
134
8.25k
            }
135
8.25k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
8.25k
                using FromFieldType = typename FromDataType::FieldType;
137
8.25k
                using ToFieldType = typename ToDataType::FieldType;
138
8.25k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
8.25k
                UInt32 from_scale = 0;
140
141
8.25k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
8.25k
                    const auto* from_decimal_type =
143
8.25k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
8.25k
                    from_precision =
145
8.25k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
8.25k
                    from_scale = from_decimal_type->get_scale();
147
8.25k
                }
148
149
8.25k
                UInt32 to_max_digits = 0;
150
8.25k
                UInt32 to_precision = 0;
151
8.25k
                UInt32 to_scale = 0;
152
153
8.25k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
8.25k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
8.25k
                    const auto* to_decimal_type =
157
8.25k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
8.25k
                    to_precision = to_decimal_type->get_precision();
159
8.25k
                    ToDataType::check_type_precision(to_precision);
160
161
8.25k
                    to_scale = to_decimal_type->get_scale();
162
8.25k
                    ToDataType::check_type_scale(to_scale);
163
8.25k
                }
164
8.25k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
8.25k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
8.25k
                    to_precision = to_max_digits;
167
8.25k
                }
168
169
8.25k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
8.25k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
8.25k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
8.25k
                if (to_scale > from_scale) {
174
8.25k
                    multiply_may_overflow &=
175
8.25k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
8.25k
                }
177
8.25k
                return narrow_integral || multiply_may_overflow;
178
8.25k
            }
179
8.25k
            return false;
180
8.25k
        });
181
8.25k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
117
3.23k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
3.23k
        using Types = std::decay_t<decltype(types)>;
119
3.23k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
3.23k
        return call_on_index_and_data_type<
127
3.23k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.23k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.23k
            using FromDataType = typename Types2::LeftType;
130
3.23k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
3.23k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
3.23k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
3.23k
                return false;
134
3.23k
            }
135
3.23k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
3.23k
                using FromFieldType = typename FromDataType::FieldType;
137
3.23k
                using ToFieldType = typename ToDataType::FieldType;
138
3.23k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
3.23k
                UInt32 from_scale = 0;
140
141
3.23k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
3.23k
                    const auto* from_decimal_type =
143
3.23k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
3.23k
                    from_precision =
145
3.23k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
3.23k
                    from_scale = from_decimal_type->get_scale();
147
3.23k
                }
148
149
3.23k
                UInt32 to_max_digits = 0;
150
3.23k
                UInt32 to_precision = 0;
151
3.23k
                UInt32 to_scale = 0;
152
153
3.23k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
3.23k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
3.23k
                    const auto* to_decimal_type =
157
3.23k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
3.23k
                    to_precision = to_decimal_type->get_precision();
159
3.23k
                    ToDataType::check_type_precision(to_precision);
160
161
3.23k
                    to_scale = to_decimal_type->get_scale();
162
3.23k
                    ToDataType::check_type_scale(to_scale);
163
3.23k
                }
164
3.23k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
3.23k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
3.23k
                    to_precision = to_max_digits;
167
3.23k
                }
168
169
3.23k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
3.23k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
3.23k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
3.23k
                if (to_scale > from_scale) {
174
3.23k
                    multiply_may_overflow &=
175
3.23k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
3.23k
                }
177
3.23k
                return narrow_integral || multiply_may_overflow;
178
3.23k
            }
179
3.23k
            return false;
180
3.23k
        });
181
3.23k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
117
3.21k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
3.21k
        using Types = std::decay_t<decltype(types)>;
119
3.21k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
3.21k
        return call_on_index_and_data_type<
127
3.21k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.21k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.21k
            using FromDataType = typename Types2::LeftType;
130
3.21k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
3.21k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
3.21k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
3.21k
                return false;
134
3.21k
            }
135
3.21k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
3.21k
                using FromFieldType = typename FromDataType::FieldType;
137
3.21k
                using ToFieldType = typename ToDataType::FieldType;
138
3.21k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
3.21k
                UInt32 from_scale = 0;
140
141
3.21k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
3.21k
                    const auto* from_decimal_type =
143
3.21k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
3.21k
                    from_precision =
145
3.21k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
3.21k
                    from_scale = from_decimal_type->get_scale();
147
3.21k
                }
148
149
3.21k
                UInt32 to_max_digits = 0;
150
3.21k
                UInt32 to_precision = 0;
151
3.21k
                UInt32 to_scale = 0;
152
153
3.21k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
3.21k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
3.21k
                    const auto* to_decimal_type =
157
3.21k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
3.21k
                    to_precision = to_decimal_type->get_precision();
159
3.21k
                    ToDataType::check_type_precision(to_precision);
160
161
3.21k
                    to_scale = to_decimal_type->get_scale();
162
3.21k
                    ToDataType::check_type_scale(to_scale);
163
3.21k
                }
164
3.21k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
3.21k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
3.21k
                    to_precision = to_max_digits;
167
3.21k
                }
168
169
3.21k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
3.21k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
3.21k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
3.21k
                if (to_scale > from_scale) {
174
3.21k
                    multiply_may_overflow &=
175
3.21k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
3.21k
                }
177
3.21k
                return narrow_integral || multiply_may_overflow;
178
3.21k
            }
179
3.21k
            return false;
180
3.21k
        });
181
3.21k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
117
4
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
4
        using Types = std::decay_t<decltype(types)>;
119
4
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
4
        return call_on_index_and_data_type<
127
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4
            using Types2 = std::decay_t<decltype(types2)>;
129
4
            using FromDataType = typename Types2::LeftType;
130
4
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
4
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
4
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
4
                return false;
134
4
            }
135
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
4
                using FromFieldType = typename FromDataType::FieldType;
137
4
                using ToFieldType = typename ToDataType::FieldType;
138
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
4
                UInt32 from_scale = 0;
140
141
4
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
4
                    const auto* from_decimal_type =
143
4
                            check_and_get_data_type<FromDataType>(from_type.get());
144
4
                    from_precision =
145
4
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
4
                    from_scale = from_decimal_type->get_scale();
147
4
                }
148
149
4
                UInt32 to_max_digits = 0;
150
4
                UInt32 to_precision = 0;
151
4
                UInt32 to_scale = 0;
152
153
4
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
4
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
4
                    const auto* to_decimal_type =
157
4
                            check_and_get_data_type<ToDataType>(to_type.get());
158
4
                    to_precision = to_decimal_type->get_precision();
159
4
                    ToDataType::check_type_precision(to_precision);
160
161
4
                    to_scale = to_decimal_type->get_scale();
162
4
                    ToDataType::check_type_scale(to_scale);
163
4
                }
164
4
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
4
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
4
                    to_precision = to_max_digits;
167
4
                }
168
169
4
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
4
                if (to_scale > from_scale) {
174
4
                    multiply_may_overflow &=
175
4
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
4
                }
177
4
                return narrow_integral || multiply_may_overflow;
178
4
            }
179
4
            return false;
180
4
        });
181
4
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
117
3.01k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
3.01k
        using Types = std::decay_t<decltype(types)>;
119
3.01k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
3.01k
        return call_on_index_and_data_type<
127
3.01k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.01k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.01k
            using FromDataType = typename Types2::LeftType;
130
3.01k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
3.01k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
3.01k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
3.01k
                return false;
134
3.01k
            }
135
3.01k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
3.01k
                using FromFieldType = typename FromDataType::FieldType;
137
3.01k
                using ToFieldType = typename ToDataType::FieldType;
138
3.01k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
3.01k
                UInt32 from_scale = 0;
140
141
3.01k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
3.01k
                    const auto* from_decimal_type =
143
3.01k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
3.01k
                    from_precision =
145
3.01k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
3.01k
                    from_scale = from_decimal_type->get_scale();
147
3.01k
                }
148
149
3.01k
                UInt32 to_max_digits = 0;
150
3.01k
                UInt32 to_precision = 0;
151
3.01k
                UInt32 to_scale = 0;
152
153
3.01k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
3.01k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
3.01k
                    const auto* to_decimal_type =
157
3.01k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
3.01k
                    to_precision = to_decimal_type->get_precision();
159
3.01k
                    ToDataType::check_type_precision(to_precision);
160
161
3.01k
                    to_scale = to_decimal_type->get_scale();
162
3.01k
                    ToDataType::check_type_scale(to_scale);
163
3.01k
                }
164
3.01k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
3.01k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
3.01k
                    to_precision = to_max_digits;
167
3.01k
                }
168
169
3.01k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
3.01k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
3.01k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
3.01k
                if (to_scale > from_scale) {
174
3.01k
                    multiply_may_overflow &=
175
3.01k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
3.01k
                }
177
3.01k
                return narrow_integral || multiply_may_overflow;
178
3.01k
            }
179
3.01k
            return false;
180
3.01k
        });
181
3.01k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_
Line
Count
Source
117
2.84k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
2.84k
        using Types = std::decay_t<decltype(types)>;
119
2.84k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
2.84k
        return call_on_index_and_data_type<
127
2.84k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.84k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.84k
            using FromDataType = typename Types2::LeftType;
130
2.84k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
2.84k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.84k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.84k
                return false;
134
2.84k
            }
135
2.84k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2.84k
                using FromFieldType = typename FromDataType::FieldType;
137
2.84k
                using ToFieldType = typename ToDataType::FieldType;
138
2.84k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2.84k
                UInt32 from_scale = 0;
140
141
2.84k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2.84k
                    const auto* from_decimal_type =
143
2.84k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2.84k
                    from_precision =
145
2.84k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2.84k
                    from_scale = from_decimal_type->get_scale();
147
2.84k
                }
148
149
2.84k
                UInt32 to_max_digits = 0;
150
2.84k
                UInt32 to_precision = 0;
151
2.84k
                UInt32 to_scale = 0;
152
153
2.84k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
2.84k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
2.84k
                    const auto* to_decimal_type =
157
2.84k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
2.84k
                    to_precision = to_decimal_type->get_precision();
159
2.84k
                    ToDataType::check_type_precision(to_precision);
160
161
2.84k
                    to_scale = to_decimal_type->get_scale();
162
2.84k
                    ToDataType::check_type_scale(to_scale);
163
2.84k
                }
164
2.84k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
2.84k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
2.84k
                    to_precision = to_max_digits;
167
2.84k
                }
168
169
2.84k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2.84k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2.84k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2.84k
                if (to_scale > from_scale) {
174
2.84k
                    multiply_may_overflow &=
175
2.84k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
2.84k
                }
177
2.84k
                return narrow_integral || multiply_may_overflow;
178
2.84k
            }
179
2.84k
            return false;
180
2.84k
        });
181
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
117
71
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
71
        using Types = std::decay_t<decltype(types)>;
119
71
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
71
        return call_on_index_and_data_type<
127
71
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
71
            using Types2 = std::decay_t<decltype(types2)>;
129
71
            using FromDataType = typename Types2::LeftType;
130
71
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
71
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
71
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
71
                return false;
134
71
            }
135
71
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
71
                using FromFieldType = typename FromDataType::FieldType;
137
71
                using ToFieldType = typename ToDataType::FieldType;
138
71
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
71
                UInt32 from_scale = 0;
140
141
71
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
71
                    const auto* from_decimal_type =
143
71
                            check_and_get_data_type<FromDataType>(from_type.get());
144
71
                    from_precision =
145
71
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
71
                    from_scale = from_decimal_type->get_scale();
147
71
                }
148
149
71
                UInt32 to_max_digits = 0;
150
71
                UInt32 to_precision = 0;
151
71
                UInt32 to_scale = 0;
152
153
71
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
71
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
71
                    const auto* to_decimal_type =
157
71
                            check_and_get_data_type<ToDataType>(to_type.get());
158
71
                    to_precision = to_decimal_type->get_precision();
159
71
                    ToDataType::check_type_precision(to_precision);
160
161
71
                    to_scale = to_decimal_type->get_scale();
162
71
                    ToDataType::check_type_scale(to_scale);
163
71
                }
164
71
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
71
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
71
                    to_precision = to_max_digits;
167
71
                }
168
169
71
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
71
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
71
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
71
                if (to_scale > from_scale) {
174
71
                    multiply_may_overflow &=
175
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
71
                }
177
71
                return narrow_integral || multiply_may_overflow;
178
71
            }
179
71
            return false;
180
71
        });
181
71
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
117
72
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
72
        using Types = std::decay_t<decltype(types)>;
119
72
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
72
        return call_on_index_and_data_type<
127
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
72
            using Types2 = std::decay_t<decltype(types2)>;
129
72
            using FromDataType = typename Types2::LeftType;
130
72
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
72
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
72
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
72
                return false;
134
72
            }
135
72
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
72
                using FromFieldType = typename FromDataType::FieldType;
137
72
                using ToFieldType = typename ToDataType::FieldType;
138
72
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
72
                UInt32 from_scale = 0;
140
141
72
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
72
                    const auto* from_decimal_type =
143
72
                            check_and_get_data_type<FromDataType>(from_type.get());
144
72
                    from_precision =
145
72
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
72
                    from_scale = from_decimal_type->get_scale();
147
72
                }
148
149
72
                UInt32 to_max_digits = 0;
150
72
                UInt32 to_precision = 0;
151
72
                UInt32 to_scale = 0;
152
153
72
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
72
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
72
                    const auto* to_decimal_type =
157
72
                            check_and_get_data_type<ToDataType>(to_type.get());
158
72
                    to_precision = to_decimal_type->get_precision();
159
72
                    ToDataType::check_type_precision(to_precision);
160
161
72
                    to_scale = to_decimal_type->get_scale();
162
72
                    ToDataType::check_type_scale(to_scale);
163
72
                }
164
72
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
72
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
72
                    to_precision = to_max_digits;
167
72
                }
168
169
72
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
72
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
72
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
72
                if (to_scale > from_scale) {
174
72
                    multiply_may_overflow &=
175
72
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
72
                }
177
72
                return narrow_integral || multiply_may_overflow;
178
72
            }
179
72
            return false;
180
72
        });
181
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
117
16
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
16
        using Types = std::decay_t<decltype(types)>;
119
16
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
16
        return call_on_index_and_data_type<
127
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
16
            using Types2 = std::decay_t<decltype(types2)>;
129
16
            using FromDataType = typename Types2::LeftType;
130
16
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
16
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
16
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
16
                return false;
134
16
            }
135
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
16
                using FromFieldType = typename FromDataType::FieldType;
137
16
                using ToFieldType = typename ToDataType::FieldType;
138
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
16
                UInt32 from_scale = 0;
140
141
16
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
16
                    const auto* from_decimal_type =
143
16
                            check_and_get_data_type<FromDataType>(from_type.get());
144
16
                    from_precision =
145
16
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
16
                    from_scale = from_decimal_type->get_scale();
147
16
                }
148
149
16
                UInt32 to_max_digits = 0;
150
16
                UInt32 to_precision = 0;
151
16
                UInt32 to_scale = 0;
152
153
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
16
                    const auto* to_decimal_type =
157
16
                            check_and_get_data_type<ToDataType>(to_type.get());
158
16
                    to_precision = to_decimal_type->get_precision();
159
16
                    ToDataType::check_type_precision(to_precision);
160
161
16
                    to_scale = to_decimal_type->get_scale();
162
16
                    ToDataType::check_type_scale(to_scale);
163
16
                }
164
16
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
16
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
16
                    to_precision = to_max_digits;
167
16
                }
168
169
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
16
                if (to_scale > from_scale) {
174
16
                    multiply_may_overflow &=
175
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
16
                }
177
16
                return narrow_integral || multiply_may_overflow;
178
16
            }
179
16
            return false;
180
16
        });
181
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
117
7
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
7
        using Types = std::decay_t<decltype(types)>;
119
7
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
7
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
7
            return false;
125
7
        }
126
0
        return call_on_index_and_data_type<
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
7
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
7
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
7
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
7
                return false;
134
7
            }
135
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7
                using FromFieldType = typename FromDataType::FieldType;
137
7
                using ToFieldType = typename ToDataType::FieldType;
138
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7
                UInt32 from_scale = 0;
140
141
7
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
7
                    const auto* from_decimal_type =
143
7
                            check_and_get_data_type<FromDataType>(from_type.get());
144
7
                    from_precision =
145
7
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
7
                    from_scale = from_decimal_type->get_scale();
147
7
                }
148
149
7
                UInt32 to_max_digits = 0;
150
7
                UInt32 to_precision = 0;
151
7
                UInt32 to_scale = 0;
152
153
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7
                    const auto* to_decimal_type =
157
7
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7
                    to_precision = to_decimal_type->get_precision();
159
7
                    ToDataType::check_type_precision(to_precision);
160
161
7
                    to_scale = to_decimal_type->get_scale();
162
7
                    ToDataType::check_type_scale(to_scale);
163
7
                }
164
7
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
7
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
7
                    to_precision = to_max_digits;
167
7
                }
168
169
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7
                if (to_scale > from_scale) {
174
7
                    multiply_may_overflow &=
175
7
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
7
                }
177
7
                return narrow_integral || multiply_may_overflow;
178
7
            }
179
7
            return false;
180
7
        });
181
7
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_
Line
Count
Source
117
10
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
10
        using Types = std::decay_t<decltype(types)>;
119
10
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
10
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
10
            return false;
125
10
        }
126
0
        return call_on_index_and_data_type<
127
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
10
            using Types2 = std::decay_t<decltype(types2)>;
129
10
            using FromDataType = typename Types2::LeftType;
130
10
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
10
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
10
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
10
                return false;
134
10
            }
135
10
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
10
                using FromFieldType = typename FromDataType::FieldType;
137
10
                using ToFieldType = typename ToDataType::FieldType;
138
10
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
10
                UInt32 from_scale = 0;
140
141
10
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
10
                    const auto* from_decimal_type =
143
10
                            check_and_get_data_type<FromDataType>(from_type.get());
144
10
                    from_precision =
145
10
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
10
                    from_scale = from_decimal_type->get_scale();
147
10
                }
148
149
10
                UInt32 to_max_digits = 0;
150
10
                UInt32 to_precision = 0;
151
10
                UInt32 to_scale = 0;
152
153
10
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
10
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
10
                    const auto* to_decimal_type =
157
10
                            check_and_get_data_type<ToDataType>(to_type.get());
158
10
                    to_precision = to_decimal_type->get_precision();
159
10
                    ToDataType::check_type_precision(to_precision);
160
161
10
                    to_scale = to_decimal_type->get_scale();
162
10
                    ToDataType::check_type_scale(to_scale);
163
10
                }
164
10
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
10
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
10
                    to_precision = to_max_digits;
167
10
                }
168
169
10
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
10
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
10
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
10
                if (to_scale > from_scale) {
174
10
                    multiply_may_overflow &=
175
10
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
10
                }
177
10
                return narrow_integral || multiply_may_overflow;
178
10
            }
179
10
            return false;
180
10
        });
181
10
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_
Line
Count
Source
117
31
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
31
        using Types = std::decay_t<decltype(types)>;
119
31
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
31
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
31
            return false;
125
31
        }
126
0
        return call_on_index_and_data_type<
127
31
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
31
            using Types2 = std::decay_t<decltype(types2)>;
129
31
            using FromDataType = typename Types2::LeftType;
130
31
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
31
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
31
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
31
                return false;
134
31
            }
135
31
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
31
                using FromFieldType = typename FromDataType::FieldType;
137
31
                using ToFieldType = typename ToDataType::FieldType;
138
31
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
31
                UInt32 from_scale = 0;
140
141
31
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
31
                    const auto* from_decimal_type =
143
31
                            check_and_get_data_type<FromDataType>(from_type.get());
144
31
                    from_precision =
145
31
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
31
                    from_scale = from_decimal_type->get_scale();
147
31
                }
148
149
31
                UInt32 to_max_digits = 0;
150
31
                UInt32 to_precision = 0;
151
31
                UInt32 to_scale = 0;
152
153
31
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
31
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
31
                    const auto* to_decimal_type =
157
31
                            check_and_get_data_type<ToDataType>(to_type.get());
158
31
                    to_precision = to_decimal_type->get_precision();
159
31
                    ToDataType::check_type_precision(to_precision);
160
161
31
                    to_scale = to_decimal_type->get_scale();
162
31
                    ToDataType::check_type_scale(to_scale);
163
31
                }
164
31
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
31
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
31
                    to_precision = to_max_digits;
167
31
                }
168
169
31
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
31
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
31
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
31
                if (to_scale > from_scale) {
174
31
                    multiply_may_overflow &=
175
31
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
31
                }
177
31
                return narrow_integral || multiply_may_overflow;
178
31
            }
179
31
            return false;
180
31
        });
181
31
    };
182
183
84.7k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
184
84.8k
}
185
186
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
187
84.8k
                                    const DataTypePtr& to_type) {
188
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
189
84.8k
    bool result_is_nullable = to_type->is_nullable();
190
191
84.8k
    if (result_is_nullable) {
192
84.8k
        return [from_type, to_type](FunctionContext* context, Block& block,
193
84.8k
                                    const ColumnNumbers& arguments, uint32_t result,
194
84.8k
                                    size_t input_rows_count,
195
84.8k
                                    const NullMap::value_type* null_map = nullptr) {
196
84.8k
            auto from_type_not_nullable = remove_nullable(from_type);
197
84.8k
            auto to_type_not_nullable = remove_nullable(to_type);
198
199
84.8k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
200
84.8k
                    context, from_type_not_nullable, to_type_not_nullable);
201
202
84.8k
            auto nested_result_index = block.columns();
203
84.8k
            block.insert(block.get_by_position(result).unnest_nullable());
204
84.8k
            auto nested_source_index = block.columns();
205
84.8k
            block.insert(block.get_by_position(arguments[0])
206
84.8k
                                 .unnest_nullable(replace_null_data_to_default));
207
208
84.8k
            const auto& arg_col = block.get_by_position(arguments[0]);
209
84.8k
            const NullMap::value_type* arg_null_map = nullptr;
210
84.8k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
211
84.8k
                arg_null_map = nullable->get_null_map_data().data();
212
84.8k
            }
213
84.8k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
214
84.8k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
215
84.8k
                    arg_null_map));
216
217
61.1k
            block.get_by_position(result).column =
218
61.1k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
219
61.1k
                                     arguments, input_rows_count);
220
221
61.1k
            block.erase(nested_source_index);
222
61.1k
            block.erase(nested_result_index);
223
61.1k
            return Status::OK();
224
84.8k
        };
225
84.8k
    } else {
226
20
        return prepare_impl(context, from_type, to_type);
227
20
    }
228
84.8k
}
229
230
/// 'from_type' and 'to_type' are nested types in case of Nullable.
231
/// 'requested_result_is_nullable' is true if CAST to Nullable type is requested.
232
WrapperType prepare_impl(FunctionContext* context, const DataTypePtr& origin_from_type,
233
84.8k
                         const DataTypePtr& origin_to_type) {
234
84.8k
    auto to_type = get_serialized_type(origin_to_type);
235
84.8k
    auto from_type = get_serialized_type(origin_from_type);
236
84.8k
    if (from_type->equals(*to_type)) {
237
131
        return create_identity_wrapper(from_type);
238
131
    }
239
240
    // variant needs to be judged first
241
84.7k
    if (to_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
242
3
        return create_cast_to_variant_wrapper(from_type,
243
3
                                              static_cast<const DataTypeVariant&>(*to_type));
244
3
    }
245
84.7k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
246
10
        return create_cast_from_variant_wrapper(static_cast<const DataTypeVariant&>(*from_type),
247
10
                                                to_type);
248
10
    }
249
250
84.7k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
251
113
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
252
113
                                              to_type,
253
113
                                              context ? context->jsonb_string_as_string() : false);
254
113
    }
255
256
84.6k
    switch (to_type->get_primitive_type()) {
257
32
    case PrimitiveType::TYPE_BOOLEAN:
258
32
        return create_boolean_wrapper(context, from_type);
259
1.42k
    case PrimitiveType::TYPE_TINYINT:
260
1.42k
        return create_int_wrapper<DataTypeInt8>(context, from_type);
261
1.40k
    case PrimitiveType::TYPE_SMALLINT:
262
1.40k
        return create_int_wrapper<DataTypeInt16>(context, from_type);
263
1.26k
    case PrimitiveType::TYPE_INT:
264
1.26k
        return create_int_wrapper<DataTypeInt32>(context, from_type);
265
1.02k
    case PrimitiveType::TYPE_BIGINT:
266
1.02k
        return create_int_wrapper<DataTypeInt64>(context, from_type);
267
1.10k
    case PrimitiveType::TYPE_LARGEINT:
268
1.10k
        return create_int_wrapper<DataTypeInt128>(context, from_type);
269
8.17k
    case PrimitiveType::TYPE_FLOAT:
270
8.17k
        return create_float_wrapper<DataTypeFloat32>(context, from_type);
271
8.23k
    case PrimitiveType::TYPE_DOUBLE:
272
8.23k
        return create_float_wrapper<DataTypeFloat64>(context, from_type);
273
0
    case PrimitiveType::TYPE_DATE:
274
0
        return create_datelike_wrapper<DataTypeDate>(context, from_type);
275
0
    case PrimitiveType::TYPE_DATETIME:
276
0
        return create_datelike_wrapper<DataTypeDateTime>(context, from_type);
277
71
    case PrimitiveType::TYPE_DATEV2:
278
71
        return create_datelike_wrapper<DataTypeDateV2>(context, from_type);
279
72
    case PrimitiveType::TYPE_DATETIMEV2:
280
72
        return create_datelike_wrapper<DataTypeDateTimeV2>(context, from_type);
281
0
    case PrimitiveType::TYPE_TIMESTAMPTZ:
282
0
        return create_timestamptz_wrapper(context, from_type);
283
16
    case PrimitiveType::TYPE_TIMEV2:
284
16
        return create_datelike_wrapper<DataTypeTimeV2>(context, from_type);
285
7
    case PrimitiveType::TYPE_IPV4:
286
7
        return create_ip_wrapper<DataTypeIPv4>(context, from_type);
287
10
    case PrimitiveType::TYPE_IPV6:
288
10
        return create_ip_wrapper<DataTypeIPv6>(context, from_type);
289
4
    case PrimitiveType::TYPE_DECIMALV2:
290
4
        return create_decimal_wrapper<DataTypeDecimalV2>(context, from_type);
291
3.23k
    case PrimitiveType::TYPE_DECIMAL32:
292
3.23k
        return create_decimal_wrapper<DataTypeDecimal32>(context, from_type);
293
3.21k
    case PrimitiveType::TYPE_DECIMAL64:
294
3.21k
        return create_decimal_wrapper<DataTypeDecimal64>(context, from_type);
295
3.01k
    case PrimitiveType::TYPE_DECIMAL128I:
296
3.01k
        return create_decimal_wrapper<DataTypeDecimal128>(context, from_type);
297
2.84k
    case PrimitiveType::TYPE_DECIMAL256:
298
2.84k
        return create_decimal_wrapper<DataTypeDecimal256>(context, from_type);
299
0
    case PrimitiveType::TYPE_CHAR:
300
0
    case PrimitiveType::TYPE_VARCHAR:
301
14
    case PrimitiveType::TYPE_STRING:
302
14
        return create_string_wrapper(from_type);
303
1.34k
    case PrimitiveType::TYPE_ARRAY:
304
1.34k
        return create_array_wrapper(context, from_type,
305
1.34k
                                    static_cast<const DataTypeArray&>(*to_type));
306
2
    case PrimitiveType::TYPE_STRUCT:
307
2
        return create_struct_wrapper(context, from_type,
308
2
                                     static_cast<const DataTypeStruct&>(*to_type));
309
3
    case PrimitiveType::TYPE_MAP:
310
3
        return create_map_wrapper(context, from_type, static_cast<const DataTypeMap&>(*to_type));
311
0
    case PrimitiveType::TYPE_HLL:
312
0
        return create_hll_wrapper(context, from_type, static_cast<const DataTypeHLL&>(*to_type));
313
0
    case PrimitiveType::TYPE_BITMAP:
314
0
        return create_bitmap_wrapper(context, from_type,
315
0
                                     static_cast<const DataTypeBitMap&>(*to_type));
316
0
    case PrimitiveType::TYPE_QUANTILE_STATE:
317
0
        return create_quantile_state_wrapper(context, from_type,
318
0
                                             static_cast<const DataTypeQuantileState&>(*to_type));
319
48.0k
    case PrimitiveType::TYPE_JSONB:
320
48.0k
        return create_cast_to_jsonb_wrapper(from_type, static_cast<const DataTypeJsonb&>(*to_type),
321
48.0k
                                            context ? context->string_as_jsonb_string() : false);
322
0
    case PrimitiveType::TYPE_VARBINARY:
323
0
        return create_varbinary_wrapper(from_type);
324
0
    default:
325
0
        break;
326
84.6k
    }
327
328
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
329
84.6k
}
330
331
} // namespace CastWrapper
332
333
class PreparedFunctionCast : public PreparedFunctionImpl {
334
public:
335
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
336
83.5k
            : wrapper_function(std::move(wrapper_function_)), name(name_) {}
337
338
0
    String get_name() const override { return name; }
339
340
protected:
341
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
342
83.5k
                        uint32_t result, size_t input_rows_count) const override {
343
83.5k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
344
83.5k
    }
345
346
83.5k
    bool use_default_implementation_for_nulls() const override { return false; }
347
83.5k
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {1}; }
348
349
private:
350
    CastWrapper::WrapperType wrapper_function;
351
    const char* name;
352
};
353
354
class FunctionCast final : public IFunctionBase {
355
public:
356
    FunctionCast(const char* name_, DataTypes argument_types_, DataTypePtr return_type_)
357
84.1k
            : name(name_),
358
84.1k
              argument_types(std::move(argument_types_)),
359
84.1k
              return_type(std::move(return_type_)) {}
360
361
83.5k
    const DataTypes& get_argument_types() const override { return argument_types; }
362
83.5k
    const DataTypePtr& get_return_type() const override { return return_type; }
363
364
    PreparedFunctionPtr prepare(FunctionContext* context, const Block& /*sample_block*/,
365
                                const ColumnNumbers& /*arguments*/,
366
83.5k
                                uint32_t /*result*/) const override {
367
83.5k
        return std::make_shared<PreparedFunctionCast>(
368
83.5k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
369
83.5k
                                                         get_return_type()),
370
83.5k
                name);
371
83.5k
    }
372
373
0
    String get_name() const override { return name; }
374
375
0
    bool is_use_default_implementation_for_constants() const override { return true; }
376
377
private:
378
    const char* name = nullptr;
379
380
    DataTypes argument_types;
381
    DataTypePtr return_type;
382
};
383
384
class FunctionBuilderCast : public FunctionBuilderImpl {
385
public:
386
    static constexpr auto name = "CAST";
387
84.1k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
388
389
84.1k
    FunctionBuilderCast() = default;
390
391
1
    String get_name() const override { return name; }
392
393
0
    size_t get_number_of_arguments() const override { return 2; }
394
395
0
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {1}; }
396
397
protected:
398
    FunctionBasePtr build_impl(const ColumnsWithTypeAndName& arguments,
399
84.1k
                               const DataTypePtr& return_type) const override {
400
84.1k
        DataTypes data_types(arguments.size());
401
402
252k
        for (size_t i = 0; i < arguments.size(); ++i) {
403
168k
            data_types[i] = arguments[i].type;
404
168k
        }
405
406
84.1k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
407
84.1k
    }
408
409
84.1k
    bool skip_return_type_check() const override { return true; }
410
0
    DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override {
411
0
        return nullptr;
412
0
    }
413
414
0
    bool use_default_implementation_for_nulls() const override { return false; }
415
};
416
417
1
void register_function_cast(SimpleFunctionFactory& factory) {
418
1
    factory.register_function<FunctionBuilderCast>();
419
1
}
420
} // namespace doris