Coverage Report

Created: 2026-03-19 13:41

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
1
                                  const DataTypeBitMap& to_type) {
56
    /// Conversion from String through parsing.
57
1
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
58
1
        return cast_from_string_to_generic;
59
1
    }
60
61
0
    return CastWrapper::create_unsupport_wrapper("Cast to BitMap only support from String type");
62
1
}
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
2
WrapperType create_varbinary_wrapper(const DataTypePtr& from_type_untyped) {
77
    /// Conversion from String through parsing.
78
2
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
79
2
        return cast_from_string_to_generic;
80
2
    }
81
82
0
    return CastWrapper::create_unsupport_wrapper("Cast to Varbinary only support from String type");
83
2
}
84
85
WrapperType prepare_unpack_dictionaries(FunctionContext* context, const DataTypePtr& from_type,
86
387k
                                        const DataTypePtr& to_type) {
87
387k
    const auto& from_nested = from_type;
88
387k
    const auto& to_nested = to_type;
89
90
387k
    if (from_type->is_null_literal()) {
91
1.27k
        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
1.27k
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
97
1.27k
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
98
            /// TODO: remove this in the future.
99
1.27k
            auto& res = block.get_by_position(result);
100
1.27k
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
101
1.27k
                                 ->convert_to_full_column_if_const();
102
1.27k
            return Status::OK();
103
1.27k
        };
104
1.27k
    }
105
106
386k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
107
108
386k
    return wrapper;
109
387k
}
110
111
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
112
362k
                                       const DataTypePtr& to_type) {
113
362k
    if (from_type->equals(*to_type)) {
114
63.9k
        return false;
115
63.9k
    }
116
117
298k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
211k
        using Types = std::decay_t<decltype(types)>;
119
211k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
35.6k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
35.6k
            return false;
125
35.6k
        }
126
0
        return call_on_index_and_data_type<
127
211k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
155k
            using Types2 = std::decay_t<decltype(types2)>;
129
155k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
81.1k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
81.1k
                return false;
134
81.1k
            }
135
50.0k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
50.0k
                using FromFieldType = typename FromDataType::FieldType;
137
50.0k
                using ToFieldType = typename ToDataType::FieldType;
138
50.0k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
50.0k
                UInt32 from_scale = 0;
140
141
50.0k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
19.2k
                    const auto* from_decimal_type =
143
19.2k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
19.2k
                    from_precision =
145
19.2k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
19.2k
                    from_scale = from_decimal_type->get_scale();
147
19.2k
                }
148
149
50.0k
                UInt32 to_max_digits = 0;
150
50.0k
                UInt32 to_precision = 0;
151
50.0k
                UInt32 to_scale = 0;
152
153
50.0k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
43.8k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
43.8k
                    const auto* to_decimal_type =
157
43.8k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
43.8k
                    to_precision = to_decimal_type->get_precision();
159
43.8k
                    ToDataType::check_type_precision(to_precision);
160
161
43.8k
                    to_scale = to_decimal_type->get_scale();
162
43.8k
                    ToDataType::check_type_scale(to_scale);
163
43.8k
                }
164
50.0k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
6.11k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
6.11k
                    to_precision = to_max_digits;
167
6.11k
                }
168
169
50.0k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
50.0k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
50.0k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
50.0k
                if (to_scale > from_scale) {
174
12.1k
                    multiply_may_overflow &=
175
12.1k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
12.1k
                }
177
50.0k
                return narrow_integral || multiply_may_overflow;
178
50.0k
            }
179
0
            return false;
180
155k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
19
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
19
            using Types2 = std::decay_t<decltype(types2)>;
129
19
            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
19
            return false;
180
19
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
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
            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
14
            return false;
180
14
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
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
            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
31
            return false;
180
31
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
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_13PrimitiveTypeE2EEEvEEEEbRKT_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_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
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_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
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
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
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
                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
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
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
10
                return narrow_integral || multiply_may_overflow;
178
10
            }
179
0
            return false;
180
10
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5
            using Types2 = std::decay_t<decltype(types2)>;
129
5
            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
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5
                using FromFieldType = typename FromDataType::FieldType;
137
5
                using ToFieldType = typename ToDataType::FieldType;
138
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5
                UInt32 from_scale = 0;
140
141
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5
                    const auto* from_decimal_type =
143
5
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5
                    from_precision =
145
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5
                    from_scale = from_decimal_type->get_scale();
147
5
                }
148
149
5
                UInt32 to_max_digits = 0;
150
5
                UInt32 to_precision = 0;
151
5
                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
5
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
5
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
5
                    to_precision = to_max_digits;
167
5
                }
168
169
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
5
                return narrow_integral || multiply_may_overflow;
178
5
            }
179
0
            return false;
180
5
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
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
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5
            using Types2 = std::decay_t<decltype(types2)>;
129
5
            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
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5
                using FromFieldType = typename FromDataType::FieldType;
137
5
                using ToFieldType = typename ToDataType::FieldType;
138
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5
                UInt32 from_scale = 0;
140
141
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5
                    const auto* from_decimal_type =
143
5
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5
                    from_precision =
145
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5
                    from_scale = from_decimal_type->get_scale();
147
5
                }
148
149
5
                UInt32 to_max_digits = 0;
150
5
                UInt32 to_precision = 0;
151
5
                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
5
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
5
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
5
                    to_precision = to_max_digits;
167
5
                }
168
169
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
5
                return narrow_integral || multiply_may_overflow;
178
5
            }
179
0
            return false;
180
5
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
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
748
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
748
            using Types2 = std::decay_t<decltype(types2)>;
129
748
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
748
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
748
                return false;
134
748
            }
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
748
            return false;
180
748
        });
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
304
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
304
            using Types2 = std::decay_t<decltype(types2)>;
129
304
            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
304
            return false;
180
304
        });
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
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
            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
10
            return false;
180
10
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
127
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
127
            using Types2 = std::decay_t<decltype(types2)>;
129
127
            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
127
            return false;
180
127
        });
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
275
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
275
            using Types2 = std::decay_t<decltype(types2)>;
129
275
            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
275
            return false;
180
275
        });
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
30
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
30
            using Types2 = std::decay_t<decltype(types2)>;
129
30
            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
30
            return false;
180
30
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
127
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
20
            using Types2 = std::decay_t<decltype(types2)>;
129
20
            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
20
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
20
                using FromFieldType = typename FromDataType::FieldType;
137
20
                using ToFieldType = typename ToDataType::FieldType;
138
20
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
20
                UInt32 from_scale = 0;
140
141
20
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
20
                    const auto* from_decimal_type =
143
20
                            check_and_get_data_type<FromDataType>(from_type.get());
144
20
                    from_precision =
145
20
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
20
                    from_scale = from_decimal_type->get_scale();
147
20
                }
148
149
20
                UInt32 to_max_digits = 0;
150
20
                UInt32 to_precision = 0;
151
20
                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
20
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
20
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
20
                    to_precision = to_max_digits;
167
20
                }
168
169
20
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
20
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
20
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
20
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
20
                return narrow_integral || multiply_may_overflow;
178
20
            }
179
0
            return false;
180
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
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
24
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
24
                using FromFieldType = typename FromDataType::FieldType;
137
24
                using ToFieldType = typename ToDataType::FieldType;
138
24
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
24
                UInt32 from_scale = 0;
140
141
24
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
24
                    const auto* from_decimal_type =
143
24
                            check_and_get_data_type<FromDataType>(from_type.get());
144
24
                    from_precision =
145
24
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
24
                    from_scale = from_decimal_type->get_scale();
147
24
                }
148
149
24
                UInt32 to_max_digits = 0;
150
24
                UInt32 to_precision = 0;
151
24
                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
24
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
24
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
24
                    to_precision = to_max_digits;
167
24
                }
168
169
24
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
24
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
24
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
24
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
24
                return narrow_integral || multiply_may_overflow;
178
24
            }
179
0
            return false;
180
24
        });
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
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
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
25
                using FromFieldType = typename FromDataType::FieldType;
137
25
                using ToFieldType = typename ToDataType::FieldType;
138
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
25
                UInt32 from_scale = 0;
140
141
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
25
                    const auto* from_decimal_type =
143
25
                            check_and_get_data_type<FromDataType>(from_type.get());
144
25
                    from_precision =
145
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
25
                    from_scale = from_decimal_type->get_scale();
147
25
                }
148
149
25
                UInt32 to_max_digits = 0;
150
25
                UInt32 to_precision = 0;
151
25
                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
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
25
                    to_precision = to_max_digits;
167
25
                }
168
169
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
25
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
25
                return narrow_integral || multiply_may_overflow;
178
25
            }
179
0
            return false;
180
25
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
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
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
25
                using FromFieldType = typename FromDataType::FieldType;
137
25
                using ToFieldType = typename ToDataType::FieldType;
138
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
25
                UInt32 from_scale = 0;
140
141
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
25
                    const auto* from_decimal_type =
143
25
                            check_and_get_data_type<FromDataType>(from_type.get());
144
25
                    from_precision =
145
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
25
                    from_scale = from_decimal_type->get_scale();
147
25
                }
148
149
25
                UInt32 to_max_digits = 0;
150
25
                UInt32 to_precision = 0;
151
25
                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
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
25
                    to_precision = to_max_digits;
167
25
                }
168
169
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
25
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
25
                return narrow_integral || multiply_may_overflow;
178
25
            }
179
0
            return false;
180
25
        });
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
2.60k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.60k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.60k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.60k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.60k
                return false;
134
2.60k
            }
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.60k
            return false;
180
2.60k
        });
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
53
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
53
            using Types2 = std::decay_t<decltype(types2)>;
129
53
            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
53
            return false;
180
53
        });
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
1.98k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.98k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.98k
            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.98k
            return false;
180
1.98k
        });
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
136
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
136
            using Types2 = std::decay_t<decltype(types2)>;
129
136
            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
136
            return false;
180
136
        });
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
100
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
100
            using Types2 = std::decay_t<decltype(types2)>;
129
100
            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
100
            return false;
180
100
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
127
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
20
            using Types2 = std::decay_t<decltype(types2)>;
129
20
            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
20
            return false;
180
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
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
22
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
22
            using Types2 = std::decay_t<decltype(types2)>;
129
22
            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
22
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
22
                using FromFieldType = typename FromDataType::FieldType;
137
22
                using ToFieldType = typename ToDataType::FieldType;
138
22
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
22
                UInt32 from_scale = 0;
140
141
22
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
22
                    const auto* from_decimal_type =
143
22
                            check_and_get_data_type<FromDataType>(from_type.get());
144
22
                    from_precision =
145
22
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
22
                    from_scale = from_decimal_type->get_scale();
147
22
                }
148
149
22
                UInt32 to_max_digits = 0;
150
22
                UInt32 to_precision = 0;
151
22
                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
22
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
22
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
22
                    to_precision = to_max_digits;
167
22
                }
168
169
22
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
22
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
22
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
22
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
22
                return narrow_integral || multiply_may_overflow;
178
22
            }
179
0
            return false;
180
22
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
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
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
25
                using FromFieldType = typename FromDataType::FieldType;
137
25
                using ToFieldType = typename ToDataType::FieldType;
138
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
25
                UInt32 from_scale = 0;
140
141
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
25
                    const auto* from_decimal_type =
143
25
                            check_and_get_data_type<FromDataType>(from_type.get());
144
25
                    from_precision =
145
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
25
                    from_scale = from_decimal_type->get_scale();
147
25
                }
148
149
25
                UInt32 to_max_digits = 0;
150
25
                UInt32 to_precision = 0;
151
25
                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
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
25
                    to_precision = to_max_digits;
167
25
                }
168
169
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
25
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
25
                return narrow_integral || multiply_may_overflow;
178
25
            }
179
0
            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_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
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
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
25
                using FromFieldType = typename FromDataType::FieldType;
137
25
                using ToFieldType = typename ToDataType::FieldType;
138
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
25
                UInt32 from_scale = 0;
140
141
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
25
                    const auto* from_decimal_type =
143
25
                            check_and_get_data_type<FromDataType>(from_type.get());
144
25
                    from_precision =
145
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
25
                    from_scale = from_decimal_type->get_scale();
147
25
                }
148
149
25
                UInt32 to_max_digits = 0;
150
25
                UInt32 to_precision = 0;
151
25
                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
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
25
                    to_precision = to_max_digits;
167
25
                }
168
169
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
25
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
25
                return narrow_integral || multiply_may_overflow;
178
25
            }
179
0
            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_35EEESE_EEEEbSI_
Line
Count
Source
127
26
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
26
            using Types2 = std::decay_t<decltype(types2)>;
129
26
            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
26
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
26
                using FromFieldType = typename FromDataType::FieldType;
137
26
                using ToFieldType = typename ToDataType::FieldType;
138
26
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
26
                UInt32 from_scale = 0;
140
141
26
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
26
                    const auto* from_decimal_type =
143
26
                            check_and_get_data_type<FromDataType>(from_type.get());
144
26
                    from_precision =
145
26
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
26
                    from_scale = from_decimal_type->get_scale();
147
26
                }
148
149
26
                UInt32 to_max_digits = 0;
150
26
                UInt32 to_precision = 0;
151
26
                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
26
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
26
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
26
                    to_precision = to_max_digits;
167
26
                }
168
169
26
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
26
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
26
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
26
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
26
                return narrow_integral || multiply_may_overflow;
178
26
            }
179
0
            return false;
180
26
        });
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
2.42k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.42k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.42k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.42k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.42k
                return false;
134
2.42k
            }
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.42k
            return false;
180
2.42k
        });
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
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
            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
44
            return false;
180
44
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
1.54k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.54k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.54k
            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.54k
            return false;
180
1.54k
        });
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
386
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
386
            using Types2 = std::decay_t<decltype(types2)>;
129
386
            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
386
            return false;
180
386
        });
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
1.48k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.48k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.48k
            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.48k
            return false;
180
1.48k
        });
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
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_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
20
            using Types2 = std::decay_t<decltype(types2)>;
129
20
            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
20
            return false;
180
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
96
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
96
            using Types2 = std::decay_t<decltype(types2)>;
129
96
            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
96
            return false;
180
96
        });
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
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
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
21
                using FromFieldType = typename FromDataType::FieldType;
137
21
                using ToFieldType = typename ToDataType::FieldType;
138
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
21
                UInt32 from_scale = 0;
140
141
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
21
                    const auto* from_decimal_type =
143
21
                            check_and_get_data_type<FromDataType>(from_type.get());
144
21
                    from_precision =
145
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
21
                    from_scale = from_decimal_type->get_scale();
147
21
                }
148
149
21
                UInt32 to_max_digits = 0;
150
21
                UInt32 to_precision = 0;
151
21
                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
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
21
                    to_precision = to_max_digits;
167
21
                }
168
169
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
21
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
21
                return narrow_integral || multiply_may_overflow;
178
21
            }
179
0
            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_29EEESE_EEEEbSI_
Line
Count
Source
127
38
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
38
            using Types2 = std::decay_t<decltype(types2)>;
129
38
            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
38
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
38
                using FromFieldType = typename FromDataType::FieldType;
137
38
                using ToFieldType = typename ToDataType::FieldType;
138
38
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
38
                UInt32 from_scale = 0;
140
141
38
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
38
                    const auto* from_decimal_type =
143
38
                            check_and_get_data_type<FromDataType>(from_type.get());
144
38
                    from_precision =
145
38
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
38
                    from_scale = from_decimal_type->get_scale();
147
38
                }
148
149
38
                UInt32 to_max_digits = 0;
150
38
                UInt32 to_precision = 0;
151
38
                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
38
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
38
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
38
                    to_precision = to_max_digits;
167
38
                }
168
169
38
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
38
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
38
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
38
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
38
                return narrow_integral || multiply_may_overflow;
178
38
            }
179
0
            return false;
180
38
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
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
250
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
250
            using Types2 = std::decay_t<decltype(types2)>;
129
250
            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
250
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
250
                using FromFieldType = typename FromDataType::FieldType;
137
250
                using ToFieldType = typename ToDataType::FieldType;
138
250
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
250
                UInt32 from_scale = 0;
140
141
250
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
250
                    const auto* from_decimal_type =
143
250
                            check_and_get_data_type<FromDataType>(from_type.get());
144
250
                    from_precision =
145
250
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
250
                    from_scale = from_decimal_type->get_scale();
147
250
                }
148
149
250
                UInt32 to_max_digits = 0;
150
250
                UInt32 to_precision = 0;
151
250
                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
250
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
250
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
250
                    to_precision = to_max_digits;
167
250
                }
168
169
250
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
250
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
250
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
250
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
250
                return narrow_integral || multiply_may_overflow;
178
250
            }
179
0
            return false;
180
250
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
127
22
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
22
            using Types2 = std::decay_t<decltype(types2)>;
129
22
            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
22
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
22
                using FromFieldType = typename FromDataType::FieldType;
137
22
                using ToFieldType = typename ToDataType::FieldType;
138
22
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
22
                UInt32 from_scale = 0;
140
141
22
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
22
                    const auto* from_decimal_type =
143
22
                            check_and_get_data_type<FromDataType>(from_type.get());
144
22
                    from_precision =
145
22
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
22
                    from_scale = from_decimal_type->get_scale();
147
22
                }
148
149
22
                UInt32 to_max_digits = 0;
150
22
                UInt32 to_precision = 0;
151
22
                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
22
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
22
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
22
                    to_precision = to_max_digits;
167
22
                }
168
169
22
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
22
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
22
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
22
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
22
                return narrow_integral || multiply_may_overflow;
178
22
            }
179
0
            return false;
180
22
        });
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
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
            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
16
            return false;
180
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
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
16.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
16.9k
            using Types2 = std::decay_t<decltype(types2)>;
129
16.9k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
16.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
16.9k
                return false;
134
16.9k
            }
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
16.9k
            return false;
180
16.9k
        });
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
326
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
326
            using Types2 = std::decay_t<decltype(types2)>;
129
326
            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
326
            return false;
180
326
        });
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
1.00k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.00k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.00k
            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.00k
            return false;
180
1.00k
        });
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
665
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
665
            using Types2 = std::decay_t<decltype(types2)>;
129
665
            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
665
            return false;
180
665
        });
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
5.28k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.28k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.28k
            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
5.28k
            return false;
180
5.28k
        });
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
313
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
313
            using Types2 = std::decay_t<decltype(types2)>;
129
313
            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
313
            return false;
180
313
        });
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
642
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
642
            using Types2 = std::decay_t<decltype(types2)>;
129
642
            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
642
            return false;
180
642
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
2.31k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.31k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.31k
            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.31k
            return false;
180
2.31k
        });
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
313
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
313
            using Types2 = std::decay_t<decltype(types2)>;
129
313
            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
313
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
313
                using FromFieldType = typename FromDataType::FieldType;
137
313
                using ToFieldType = typename ToDataType::FieldType;
138
313
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
313
                UInt32 from_scale = 0;
140
141
313
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
313
                    const auto* from_decimal_type =
143
313
                            check_and_get_data_type<FromDataType>(from_type.get());
144
313
                    from_precision =
145
313
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
313
                    from_scale = from_decimal_type->get_scale();
147
313
                }
148
149
313
                UInt32 to_max_digits = 0;
150
313
                UInt32 to_precision = 0;
151
313
                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
313
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
313
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
313
                    to_precision = to_max_digits;
167
313
                }
168
169
313
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
313
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
313
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
313
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
313
                return narrow_integral || multiply_may_overflow;
178
313
            }
179
0
            return false;
180
313
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
317
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
317
            using Types2 = std::decay_t<decltype(types2)>;
129
317
            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
317
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
317
                using FromFieldType = typename FromDataType::FieldType;
137
317
                using ToFieldType = typename ToDataType::FieldType;
138
317
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
317
                UInt32 from_scale = 0;
140
141
317
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
317
                    const auto* from_decimal_type =
143
317
                            check_and_get_data_type<FromDataType>(from_type.get());
144
317
                    from_precision =
145
317
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
317
                    from_scale = from_decimal_type->get_scale();
147
317
                }
148
149
317
                UInt32 to_max_digits = 0;
150
317
                UInt32 to_precision = 0;
151
317
                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
317
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
317
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
317
                    to_precision = to_max_digits;
167
317
                }
168
169
317
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
317
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
317
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
317
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
317
                return narrow_integral || multiply_may_overflow;
178
317
            }
179
0
            return false;
180
317
        });
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
303
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
303
            using Types2 = std::decay_t<decltype(types2)>;
129
303
            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
303
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
303
                using FromFieldType = typename FromDataType::FieldType;
137
303
                using ToFieldType = typename ToDataType::FieldType;
138
303
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
303
                UInt32 from_scale = 0;
140
141
303
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
303
                    const auto* from_decimal_type =
143
303
                            check_and_get_data_type<FromDataType>(from_type.get());
144
303
                    from_precision =
145
303
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
303
                    from_scale = from_decimal_type->get_scale();
147
303
                }
148
149
303
                UInt32 to_max_digits = 0;
150
303
                UInt32 to_precision = 0;
151
303
                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
303
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
303
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
303
                    to_precision = to_max_digits;
167
303
                }
168
169
303
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
303
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
303
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
303
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
303
                return narrow_integral || multiply_may_overflow;
178
303
            }
179
0
            return false;
180
303
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
127
746
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
746
            using Types2 = std::decay_t<decltype(types2)>;
129
746
            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
746
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
746
                using FromFieldType = typename FromDataType::FieldType;
137
746
                using ToFieldType = typename ToDataType::FieldType;
138
746
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
746
                UInt32 from_scale = 0;
140
141
746
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
746
                    const auto* from_decimal_type =
143
746
                            check_and_get_data_type<FromDataType>(from_type.get());
144
746
                    from_precision =
145
746
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
746
                    from_scale = from_decimal_type->get_scale();
147
746
                }
148
149
746
                UInt32 to_max_digits = 0;
150
746
                UInt32 to_precision = 0;
151
746
                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
746
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
746
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
746
                    to_precision = to_max_digits;
167
746
                }
168
169
746
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
746
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
746
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
746
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
746
                return narrow_integral || multiply_may_overflow;
178
746
            }
179
0
            return false;
180
746
        });
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
22
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
22
            using Types2 = std::decay_t<decltype(types2)>;
129
22
            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
22
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
22
                using FromFieldType = typename FromDataType::FieldType;
137
22
                using ToFieldType = typename ToDataType::FieldType;
138
22
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
22
                UInt32 from_scale = 0;
140
141
22
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
22
                    const auto* from_decimal_type =
143
22
                            check_and_get_data_type<FromDataType>(from_type.get());
144
22
                    from_precision =
145
22
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
22
                    from_scale = from_decimal_type->get_scale();
147
22
                }
148
149
22
                UInt32 to_max_digits = 0;
150
22
                UInt32 to_precision = 0;
151
22
                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
22
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
22
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
22
                    to_precision = to_max_digits;
167
22
                }
168
169
22
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
22
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
22
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
22
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
22
                return narrow_integral || multiply_may_overflow;
178
22
            }
179
0
            return false;
180
22
        });
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
1.24k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.24k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.24k
            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.24k
            return false;
180
1.24k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
127
1.25k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.25k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.25k
            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.25k
            return false;
180
1.25k
        });
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
17.3k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
17.3k
            using Types2 = std::decay_t<decltype(types2)>;
129
17.3k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
17.3k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
17.3k
                return false;
134
17.3k
            }
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.3k
            return false;
180
17.3k
        });
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
144
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
144
            using Types2 = std::decay_t<decltype(types2)>;
129
144
            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
144
            return false;
180
144
        });
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
109
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
109
            using Types2 = std::decay_t<decltype(types2)>;
129
109
            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
109
            return false;
180
109
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
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_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_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
            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
135
            return false;
180
135
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
127
584
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
584
            using Types2 = std::decay_t<decltype(types2)>;
129
584
            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
584
            return false;
180
584
        });
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
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_29EEESE_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
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
21
                using FromFieldType = typename FromDataType::FieldType;
137
21
                using ToFieldType = typename ToDataType::FieldType;
138
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
21
                UInt32 from_scale = 0;
140
141
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
21
                    const auto* from_decimal_type =
143
21
                            check_and_get_data_type<FromDataType>(from_type.get());
144
21
                    from_precision =
145
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
21
                    from_scale = from_decimal_type->get_scale();
147
21
                }
148
149
21
                UInt32 to_max_digits = 0;
150
21
                UInt32 to_precision = 0;
151
21
                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
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
21
                    to_precision = to_max_digits;
167
21
                }
168
169
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
21
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
21
                return narrow_integral || multiply_may_overflow;
178
21
            }
179
0
            return false;
180
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
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
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
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
21
                using FromFieldType = typename FromDataType::FieldType;
137
21
                using ToFieldType = typename ToDataType::FieldType;
138
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
21
                UInt32 from_scale = 0;
140
141
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
21
                    const auto* from_decimal_type =
143
21
                            check_and_get_data_type<FromDataType>(from_type.get());
144
21
                    from_precision =
145
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
21
                    from_scale = from_decimal_type->get_scale();
147
21
                }
148
149
21
                UInt32 to_max_digits = 0;
150
21
                UInt32 to_precision = 0;
151
21
                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
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
21
                    to_precision = to_max_digits;
167
21
                }
168
169
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
21
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
21
                return narrow_integral || multiply_may_overflow;
178
21
            }
179
0
            return false;
180
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
127
783
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
783
            using Types2 = std::decay_t<decltype(types2)>;
129
783
            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
783
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
783
                using FromFieldType = typename FromDataType::FieldType;
137
783
                using ToFieldType = typename ToDataType::FieldType;
138
783
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
783
                UInt32 from_scale = 0;
140
141
783
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
783
                    const auto* from_decimal_type =
143
783
                            check_and_get_data_type<FromDataType>(from_type.get());
144
783
                    from_precision =
145
783
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
783
                    from_scale = from_decimal_type->get_scale();
147
783
                }
148
149
783
                UInt32 to_max_digits = 0;
150
783
                UInt32 to_precision = 0;
151
783
                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
783
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
783
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
783
                    to_precision = to_max_digits;
167
783
                }
168
169
783
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
783
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
783
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
783
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
783
                return narrow_integral || multiply_may_overflow;
178
783
            }
179
0
            return false;
180
783
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
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
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
            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
16
            return false;
180
16
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
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
2.30k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.30k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.30k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.30k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.30k
                return false;
134
2.30k
            }
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.30k
            return false;
180
2.30k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
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
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
            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
29
            return false;
180
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
127
6
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
6
            using Types2 = std::decay_t<decltype(types2)>;
129
6
            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
6
            return false;
180
6
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
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
            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
18
            return false;
180
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
127
6
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
6
            using Types2 = std::decay_t<decltype(types2)>;
129
6
            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
6
            return false;
180
6
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
127
115
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
115
            using Types2 = std::decay_t<decltype(types2)>;
129
115
            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
115
            return false;
180
115
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
89
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
89
            using Types2 = std::decay_t<decltype(types2)>;
129
89
            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
89
            return false;
180
89
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
127
117
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
117
            using Types2 = std::decay_t<decltype(types2)>;
129
117
            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
117
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
117
                using FromFieldType = typename FromDataType::FieldType;
137
117
                using ToFieldType = typename ToDataType::FieldType;
138
117
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
117
                UInt32 from_scale = 0;
140
141
117
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
117
                    const auto* from_decimal_type =
143
117
                            check_and_get_data_type<FromDataType>(from_type.get());
144
117
                    from_precision =
145
117
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
117
                    from_scale = from_decimal_type->get_scale();
147
117
                }
148
149
117
                UInt32 to_max_digits = 0;
150
117
                UInt32 to_precision = 0;
151
117
                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
117
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
117
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
117
                    to_precision = to_max_digits;
167
117
                }
168
169
117
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
117
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
117
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
117
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
117
                return narrow_integral || multiply_may_overflow;
178
117
            }
179
0
            return false;
180
117
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
112
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
112
            using Types2 = std::decay_t<decltype(types2)>;
129
112
            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
112
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
112
                using FromFieldType = typename FromDataType::FieldType;
137
112
                using ToFieldType = typename ToDataType::FieldType;
138
112
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
112
                UInt32 from_scale = 0;
140
141
112
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
112
                    const auto* from_decimal_type =
143
112
                            check_and_get_data_type<FromDataType>(from_type.get());
144
112
                    from_precision =
145
112
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
112
                    from_scale = from_decimal_type->get_scale();
147
112
                }
148
149
112
                UInt32 to_max_digits = 0;
150
112
                UInt32 to_precision = 0;
151
112
                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
112
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
112
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
112
                    to_precision = to_max_digits;
167
112
                }
168
169
112
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
112
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
112
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
112
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
112
                return narrow_integral || multiply_may_overflow;
178
112
            }
179
0
            return false;
180
112
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
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
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
103
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
103
                    const auto* from_decimal_type =
143
103
                            check_and_get_data_type<FromDataType>(from_type.get());
144
103
                    from_precision =
145
103
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
103
                    from_scale = from_decimal_type->get_scale();
147
103
                }
148
149
103
                UInt32 to_max_digits = 0;
150
103
                UInt32 to_precision = 0;
151
103
                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
103
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
103
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
103
                    to_precision = to_max_digits;
167
103
                }
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
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
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_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
127
554
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
554
            using Types2 = std::decay_t<decltype(types2)>;
129
554
            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
554
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
554
                using FromFieldType = typename FromDataType::FieldType;
137
554
                using ToFieldType = typename ToDataType::FieldType;
138
554
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
554
                UInt32 from_scale = 0;
140
141
554
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
554
                    const auto* from_decimal_type =
143
554
                            check_and_get_data_type<FromDataType>(from_type.get());
144
554
                    from_precision =
145
554
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
554
                    from_scale = from_decimal_type->get_scale();
147
554
                }
148
149
554
                UInt32 to_max_digits = 0;
150
554
                UInt32 to_precision = 0;
151
554
                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
554
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
554
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
554
                    to_precision = to_max_digits;
167
554
                }
168
169
554
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
554
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
554
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
554
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
554
                return narrow_integral || multiply_may_overflow;
178
554
            }
179
0
            return false;
180
554
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
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
            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
39
            return false;
180
39
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
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
1.61k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.61k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.61k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.61k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.61k
                return false;
134
1.61k
            }
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.61k
            return false;
180
1.61k
        });
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
256
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
256
            using Types2 = std::decay_t<decltype(types2)>;
129
256
            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
256
            return false;
180
256
        });
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
462
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
462
            using Types2 = std::decay_t<decltype(types2)>;
129
462
            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
462
            return false;
180
462
        });
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
1.01k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.01k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.01k
            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.01k
            return false;
180
1.01k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
1.11k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.11k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.11k
            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.11k
            return false;
180
1.11k
        });
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
1.25k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.25k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.25k
            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.25k
            return false;
180
1.25k
        });
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
198
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
198
            using Types2 = std::decay_t<decltype(types2)>;
129
198
            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
198
            return false;
180
198
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
1.06k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.06k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.06k
            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.06k
            return false;
180
1.06k
        });
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
456
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
456
            using Types2 = std::decay_t<decltype(types2)>;
129
456
            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
456
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
456
                using FromFieldType = typename FromDataType::FieldType;
137
456
                using ToFieldType = typename ToDataType::FieldType;
138
456
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
456
                UInt32 from_scale = 0;
140
141
456
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
456
                    const auto* from_decimal_type =
143
456
                            check_and_get_data_type<FromDataType>(from_type.get());
144
456
                    from_precision =
145
456
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
456
                    from_scale = from_decimal_type->get_scale();
147
456
                }
148
149
456
                UInt32 to_max_digits = 0;
150
456
                UInt32 to_precision = 0;
151
456
                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
456
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
456
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
456
                    to_precision = to_max_digits;
167
456
                }
168
169
456
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
456
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
456
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
456
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
456
                return narrow_integral || multiply_may_overflow;
178
456
            }
179
0
            return false;
180
456
        });
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
336
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
336
            using Types2 = std::decay_t<decltype(types2)>;
129
336
            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
336
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
336
                using FromFieldType = typename FromDataType::FieldType;
137
336
                using ToFieldType = typename ToDataType::FieldType;
138
336
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
336
                UInt32 from_scale = 0;
140
141
336
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
336
                    const auto* from_decimal_type =
143
336
                            check_and_get_data_type<FromDataType>(from_type.get());
144
336
                    from_precision =
145
336
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
336
                    from_scale = from_decimal_type->get_scale();
147
336
                }
148
149
336
                UInt32 to_max_digits = 0;
150
336
                UInt32 to_precision = 0;
151
336
                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
336
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
336
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
336
                    to_precision = to_max_digits;
167
336
                }
168
169
336
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
336
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
336
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
336
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
336
                return narrow_integral || multiply_may_overflow;
178
336
            }
179
0
            return false;
180
336
        });
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
54
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
54
            using Types2 = std::decay_t<decltype(types2)>;
129
54
            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
54
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
54
                using FromFieldType = typename FromDataType::FieldType;
137
54
                using ToFieldType = typename ToDataType::FieldType;
138
54
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
54
                UInt32 from_scale = 0;
140
141
54
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
54
                    const auto* from_decimal_type =
143
54
                            check_and_get_data_type<FromDataType>(from_type.get());
144
54
                    from_precision =
145
54
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
54
                    from_scale = from_decimal_type->get_scale();
147
54
                }
148
149
54
                UInt32 to_max_digits = 0;
150
54
                UInt32 to_precision = 0;
151
54
                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
54
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
54
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
54
                    to_precision = to_max_digits;
167
54
                }
168
169
54
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
54
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
54
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
54
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
54
                return narrow_integral || multiply_may_overflow;
178
54
            }
179
0
            return false;
180
54
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
127
690
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
690
            using Types2 = std::decay_t<decltype(types2)>;
129
690
            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
690
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
690
                using FromFieldType = typename FromDataType::FieldType;
137
690
                using ToFieldType = typename ToDataType::FieldType;
138
690
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
690
                UInt32 from_scale = 0;
140
141
690
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
690
                    const auto* from_decimal_type =
143
690
                            check_and_get_data_type<FromDataType>(from_type.get());
144
690
                    from_precision =
145
690
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
690
                    from_scale = from_decimal_type->get_scale();
147
690
                }
148
149
690
                UInt32 to_max_digits = 0;
150
690
                UInt32 to_precision = 0;
151
690
                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
690
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
690
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
690
                    to_precision = to_max_digits;
167
690
                }
168
169
690
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
690
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
690
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
690
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
690
                return narrow_integral || multiply_may_overflow;
178
690
            }
179
0
            return false;
180
690
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
127
540
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
540
            using Types2 = std::decay_t<decltype(types2)>;
129
540
            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
540
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
540
                using FromFieldType = typename FromDataType::FieldType;
137
540
                using ToFieldType = typename ToDataType::FieldType;
138
540
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
540
                UInt32 from_scale = 0;
140
141
540
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
540
                    const auto* from_decimal_type =
143
540
                            check_and_get_data_type<FromDataType>(from_type.get());
144
540
                    from_precision =
145
540
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
540
                    from_scale = from_decimal_type->get_scale();
147
540
                }
148
149
540
                UInt32 to_max_digits = 0;
150
540
                UInt32 to_precision = 0;
151
540
                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
540
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
540
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
540
                    to_precision = to_max_digits;
167
540
                }
168
169
540
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
540
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
540
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
540
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
540
                return narrow_integral || multiply_may_overflow;
178
540
            }
179
0
            return false;
180
540
        });
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
58
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
58
            using Types2 = std::decay_t<decltype(types2)>;
129
58
            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
58
            return false;
180
58
        });
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.80k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.80k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.80k
            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.80k
            return false;
180
7.80k
        });
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
6.23k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
6.23k
            using Types2 = std::decay_t<decltype(types2)>;
129
6.23k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
6.23k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
6.23k
                return false;
134
6.23k
            }
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
6.23k
            return false;
180
6.23k
        });
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
19
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
19
            using Types2 = std::decay_t<decltype(types2)>;
129
19
            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
19
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
19
                using FromFieldType = typename FromDataType::FieldType;
137
19
                using ToFieldType = typename ToDataType::FieldType;
138
19
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
19
                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
19
                UInt32 to_max_digits = 0;
150
19
                UInt32 to_precision = 0;
151
19
                UInt32 to_scale = 0;
152
153
19
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
19
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
19
                    const auto* to_decimal_type =
157
19
                            check_and_get_data_type<ToDataType>(to_type.get());
158
19
                    to_precision = to_decimal_type->get_precision();
159
19
                    ToDataType::check_type_precision(to_precision);
160
161
19
                    to_scale = to_decimal_type->get_scale();
162
19
                    ToDataType::check_type_scale(to_scale);
163
19
                }
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
19
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
19
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
19
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
19
                if (to_scale > from_scale) {
174
18
                    multiply_may_overflow &=
175
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
18
                }
177
19
                return narrow_integral || multiply_may_overflow;
178
19
            }
179
0
            return false;
180
19
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
508
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
508
            using Types2 = std::decay_t<decltype(types2)>;
129
508
            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
508
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
508
                using FromFieldType = typename FromDataType::FieldType;
137
508
                using ToFieldType = typename ToDataType::FieldType;
138
508
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
508
                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
508
                UInt32 to_max_digits = 0;
150
508
                UInt32 to_precision = 0;
151
508
                UInt32 to_scale = 0;
152
153
508
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
508
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
508
                    const auto* to_decimal_type =
157
508
                            check_and_get_data_type<ToDataType>(to_type.get());
158
508
                    to_precision = to_decimal_type->get_precision();
159
508
                    ToDataType::check_type_precision(to_precision);
160
161
508
                    to_scale = to_decimal_type->get_scale();
162
508
                    ToDataType::check_type_scale(to_scale);
163
508
                }
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
508
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
508
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
508
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
508
                if (to_scale > from_scale) {
174
303
                    multiply_may_overflow &=
175
303
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
303
                }
177
508
                return narrow_integral || multiply_may_overflow;
178
508
            }
179
0
            return false;
180
508
        });
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
515
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
515
            using Types2 = std::decay_t<decltype(types2)>;
129
515
            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
515
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
515
                using FromFieldType = typename FromDataType::FieldType;
137
515
                using ToFieldType = typename ToDataType::FieldType;
138
515
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
515
                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
515
                UInt32 to_max_digits = 0;
150
515
                UInt32 to_precision = 0;
151
515
                UInt32 to_scale = 0;
152
153
515
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
515
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
515
                    const auto* to_decimal_type =
157
515
                            check_and_get_data_type<ToDataType>(to_type.get());
158
515
                    to_precision = to_decimal_type->get_precision();
159
515
                    ToDataType::check_type_precision(to_precision);
160
161
515
                    to_scale = to_decimal_type->get_scale();
162
515
                    ToDataType::check_type_scale(to_scale);
163
515
                }
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
515
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
515
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
515
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
515
                if (to_scale > from_scale) {
174
262
                    multiply_may_overflow &=
175
262
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
262
                }
177
515
                return narrow_integral || multiply_may_overflow;
178
515
            }
179
0
            return false;
180
515
        });
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
553
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
553
            using Types2 = std::decay_t<decltype(types2)>;
129
553
            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
553
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
553
                using FromFieldType = typename FromDataType::FieldType;
137
553
                using ToFieldType = typename ToDataType::FieldType;
138
553
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
553
                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
553
                UInt32 to_max_digits = 0;
150
553
                UInt32 to_precision = 0;
151
553
                UInt32 to_scale = 0;
152
153
553
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
553
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
553
                    const auto* to_decimal_type =
157
553
                            check_and_get_data_type<ToDataType>(to_type.get());
158
553
                    to_precision = to_decimal_type->get_precision();
159
553
                    ToDataType::check_type_precision(to_precision);
160
161
553
                    to_scale = to_decimal_type->get_scale();
162
553
                    ToDataType::check_type_scale(to_scale);
163
553
                }
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
553
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
553
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
553
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
553
                if (to_scale > from_scale) {
174
280
                    multiply_may_overflow &=
175
280
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
280
                }
177
553
                return narrow_integral || multiply_may_overflow;
178
553
            }
179
0
            return false;
180
553
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
127
612
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
612
            using Types2 = std::decay_t<decltype(types2)>;
129
612
            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
612
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
612
                using FromFieldType = typename FromDataType::FieldType;
137
612
                using ToFieldType = typename ToDataType::FieldType;
138
612
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
612
                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
612
                UInt32 to_max_digits = 0;
150
612
                UInt32 to_precision = 0;
151
612
                UInt32 to_scale = 0;
152
153
612
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
612
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
612
                    const auto* to_decimal_type =
157
612
                            check_and_get_data_type<ToDataType>(to_type.get());
158
612
                    to_precision = to_decimal_type->get_precision();
159
612
                    ToDataType::check_type_precision(to_precision);
160
161
612
                    to_scale = to_decimal_type->get_scale();
162
612
                    ToDataType::check_type_scale(to_scale);
163
612
                }
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
612
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
612
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
612
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
612
                if (to_scale > from_scale) {
174
266
                    multiply_may_overflow &=
175
266
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
266
                }
177
612
                return narrow_integral || multiply_may_overflow;
178
612
            }
179
0
            return false;
180
612
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
127
549
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
549
            using Types2 = std::decay_t<decltype(types2)>;
129
549
            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
549
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
549
                using FromFieldType = typename FromDataType::FieldType;
137
549
                using ToFieldType = typename ToDataType::FieldType;
138
549
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
549
                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
549
                UInt32 to_max_digits = 0;
150
549
                UInt32 to_precision = 0;
151
549
                UInt32 to_scale = 0;
152
153
549
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
549
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
549
                    const auto* to_decimal_type =
157
549
                            check_and_get_data_type<ToDataType>(to_type.get());
158
549
                    to_precision = to_decimal_type->get_precision();
159
549
                    ToDataType::check_type_precision(to_precision);
160
161
549
                    to_scale = to_decimal_type->get_scale();
162
549
                    ToDataType::check_type_scale(to_scale);
163
549
                }
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
549
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
549
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
549
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
549
                if (to_scale > from_scale) {
174
278
                    multiply_may_overflow &=
175
278
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
278
                }
177
549
                return narrow_integral || multiply_may_overflow;
178
549
            }
179
0
            return false;
180
549
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
104
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
104
            using Types2 = std::decay_t<decltype(types2)>;
129
104
            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
104
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
104
                using FromFieldType = typename FromDataType::FieldType;
137
104
                using ToFieldType = typename ToDataType::FieldType;
138
104
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
104
                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
104
                UInt32 to_max_digits = 0;
150
104
                UInt32 to_precision = 0;
151
104
                UInt32 to_scale = 0;
152
153
104
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
104
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
104
                    const auto* to_decimal_type =
157
104
                            check_and_get_data_type<ToDataType>(to_type.get());
158
104
                    to_precision = to_decimal_type->get_precision();
159
104
                    ToDataType::check_type_precision(to_precision);
160
161
104
                    to_scale = to_decimal_type->get_scale();
162
104
                    ToDataType::check_type_scale(to_scale);
163
104
                }
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
104
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
104
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
104
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
104
                if (to_scale > from_scale) {
174
68
                    multiply_may_overflow &=
175
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
68
                }
177
104
                return narrow_integral || multiply_may_overflow;
178
104
            }
179
0
            return false;
180
104
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
307
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
307
            using Types2 = std::decay_t<decltype(types2)>;
129
307
            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
307
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
307
                using FromFieldType = typename FromDataType::FieldType;
137
307
                using ToFieldType = typename ToDataType::FieldType;
138
307
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
307
                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
307
                UInt32 to_max_digits = 0;
150
307
                UInt32 to_precision = 0;
151
307
                UInt32 to_scale = 0;
152
153
307
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
307
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
307
                    const auto* to_decimal_type =
157
307
                            check_and_get_data_type<ToDataType>(to_type.get());
158
307
                    to_precision = to_decimal_type->get_precision();
159
307
                    ToDataType::check_type_precision(to_precision);
160
161
307
                    to_scale = to_decimal_type->get_scale();
162
307
                    ToDataType::check_type_scale(to_scale);
163
307
                }
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
307
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
307
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
307
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
307
                if (to_scale > from_scale) {
174
258
                    multiply_may_overflow &=
175
258
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
258
                }
177
307
                return narrow_integral || multiply_may_overflow;
178
307
            }
179
0
            return false;
180
307
        });
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
417
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
417
            using Types2 = std::decay_t<decltype(types2)>;
129
417
            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
417
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
417
                using FromFieldType = typename FromDataType::FieldType;
137
417
                using ToFieldType = typename ToDataType::FieldType;
138
417
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
417
                UInt32 from_scale = 0;
140
141
417
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
417
                    const auto* from_decimal_type =
143
417
                            check_and_get_data_type<FromDataType>(from_type.get());
144
417
                    from_precision =
145
417
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
417
                    from_scale = from_decimal_type->get_scale();
147
417
                }
148
149
417
                UInt32 to_max_digits = 0;
150
417
                UInt32 to_precision = 0;
151
417
                UInt32 to_scale = 0;
152
153
417
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
417
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
417
                    const auto* to_decimal_type =
157
417
                            check_and_get_data_type<ToDataType>(to_type.get());
158
417
                    to_precision = to_decimal_type->get_precision();
159
417
                    ToDataType::check_type_precision(to_precision);
160
161
417
                    to_scale = to_decimal_type->get_scale();
162
417
                    ToDataType::check_type_scale(to_scale);
163
417
                }
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
417
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
417
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
417
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
417
                if (to_scale > from_scale) {
174
90
                    multiply_may_overflow &=
175
90
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
90
                }
177
417
                return narrow_integral || multiply_may_overflow;
178
417
            }
179
0
            return false;
180
417
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
508
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
508
            using Types2 = std::decay_t<decltype(types2)>;
129
508
            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
508
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
508
                using FromFieldType = typename FromDataType::FieldType;
137
508
                using ToFieldType = typename ToDataType::FieldType;
138
508
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
508
                UInt32 from_scale = 0;
140
141
508
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
508
                    const auto* from_decimal_type =
143
508
                            check_and_get_data_type<FromDataType>(from_type.get());
144
508
                    from_precision =
145
508
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
508
                    from_scale = from_decimal_type->get_scale();
147
508
                }
148
149
508
                UInt32 to_max_digits = 0;
150
508
                UInt32 to_precision = 0;
151
508
                UInt32 to_scale = 0;
152
153
508
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
508
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
508
                    const auto* to_decimal_type =
157
508
                            check_and_get_data_type<ToDataType>(to_type.get());
158
508
                    to_precision = to_decimal_type->get_precision();
159
508
                    ToDataType::check_type_precision(to_precision);
160
161
508
                    to_scale = to_decimal_type->get_scale();
162
508
                    ToDataType::check_type_scale(to_scale);
163
508
                }
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
508
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
508
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
508
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
508
                if (to_scale > from_scale) {
174
86
                    multiply_may_overflow &=
175
86
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
86
                }
177
508
                return narrow_integral || multiply_may_overflow;
178
508
            }
179
0
            return false;
180
508
        });
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
204
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
204
            using Types2 = std::decay_t<decltype(types2)>;
129
204
            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
204
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
204
                using FromFieldType = typename FromDataType::FieldType;
137
204
                using ToFieldType = typename ToDataType::FieldType;
138
204
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
204
                UInt32 from_scale = 0;
140
141
204
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
204
                    const auto* from_decimal_type =
143
204
                            check_and_get_data_type<FromDataType>(from_type.get());
144
204
                    from_precision =
145
204
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
204
                    from_scale = from_decimal_type->get_scale();
147
204
                }
148
149
204
                UInt32 to_max_digits = 0;
150
204
                UInt32 to_precision = 0;
151
204
                UInt32 to_scale = 0;
152
153
204
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
204
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
204
                    const auto* to_decimal_type =
157
204
                            check_and_get_data_type<ToDataType>(to_type.get());
158
204
                    to_precision = to_decimal_type->get_precision();
159
204
                    ToDataType::check_type_precision(to_precision);
160
161
204
                    to_scale = to_decimal_type->get_scale();
162
204
                    ToDataType::check_type_scale(to_scale);
163
204
                }
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
204
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
204
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
204
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
204
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
204
                return narrow_integral || multiply_may_overflow;
178
204
            }
179
0
            return false;
180
204
        });
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
317
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
317
            using Types2 = std::decay_t<decltype(types2)>;
129
317
            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
317
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
317
                using FromFieldType = typename FromDataType::FieldType;
137
317
                using ToFieldType = typename ToDataType::FieldType;
138
317
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
317
                UInt32 from_scale = 0;
140
141
317
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
317
                    const auto* from_decimal_type =
143
317
                            check_and_get_data_type<FromDataType>(from_type.get());
144
317
                    from_precision =
145
317
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
317
                    from_scale = from_decimal_type->get_scale();
147
317
                }
148
149
317
                UInt32 to_max_digits = 0;
150
317
                UInt32 to_precision = 0;
151
317
                UInt32 to_scale = 0;
152
153
317
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
317
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
317
                    const auto* to_decimal_type =
157
317
                            check_and_get_data_type<ToDataType>(to_type.get());
158
317
                    to_precision = to_decimal_type->get_precision();
159
317
                    ToDataType::check_type_precision(to_precision);
160
161
317
                    to_scale = to_decimal_type->get_scale();
162
317
                    ToDataType::check_type_scale(to_scale);
163
317
                }
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
317
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
317
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
317
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
317
                if (to_scale > from_scale) {
174
83
                    multiply_may_overflow &=
175
83
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
83
                }
177
317
                return narrow_integral || multiply_may_overflow;
178
317
            }
179
0
            return false;
180
317
        });
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
303
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
303
            using Types2 = std::decay_t<decltype(types2)>;
129
303
            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
303
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
303
                using FromFieldType = typename FromDataType::FieldType;
137
303
                using ToFieldType = typename ToDataType::FieldType;
138
303
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
303
                UInt32 from_scale = 0;
140
141
303
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
303
                    const auto* from_decimal_type =
143
303
                            check_and_get_data_type<FromDataType>(from_type.get());
144
303
                    from_precision =
145
303
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
303
                    from_scale = from_decimal_type->get_scale();
147
303
                }
148
149
303
                UInt32 to_max_digits = 0;
150
303
                UInt32 to_precision = 0;
151
303
                UInt32 to_scale = 0;
152
153
303
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
303
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
303
                    const auto* to_decimal_type =
157
303
                            check_and_get_data_type<ToDataType>(to_type.get());
158
303
                    to_precision = to_decimal_type->get_precision();
159
303
                    ToDataType::check_type_precision(to_precision);
160
161
303
                    to_scale = to_decimal_type->get_scale();
162
303
                    ToDataType::check_type_scale(to_scale);
163
303
                }
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
303
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
303
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
303
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
303
                if (to_scale > from_scale) {
174
79
                    multiply_may_overflow &=
175
79
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
79
                }
177
303
                return narrow_integral || multiply_may_overflow;
178
303
            }
179
0
            return false;
180
303
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
127
2.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.78k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.78k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.78k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.78k
                return false;
134
2.78k
            }
135
2.78k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2.78k
                using FromFieldType = typename FromDataType::FieldType;
137
2.78k
                using ToFieldType = typename ToDataType::FieldType;
138
2.78k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2.78k
                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
2.78k
                UInt32 to_max_digits = 0;
150
2.78k
                UInt32 to_precision = 0;
151
2.78k
                UInt32 to_scale = 0;
152
153
2.78k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
2.78k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
2.78k
                    const auto* to_decimal_type =
157
2.78k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
2.78k
                    to_precision = to_decimal_type->get_precision();
159
2.78k
                    ToDataType::check_type_precision(to_precision);
160
161
2.78k
                    to_scale = to_decimal_type->get_scale();
162
2.78k
                    ToDataType::check_type_scale(to_scale);
163
2.78k
                }
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.78k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2.78k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2.78k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2.78k
                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.78k
                return narrow_integral || multiply_may_overflow;
178
2.78k
            }
179
0
            return false;
180
2.78k
        });
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
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
17
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
17
                using FromFieldType = typename FromDataType::FieldType;
137
17
                using ToFieldType = typename ToDataType::FieldType;
138
17
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
17
                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
17
                UInt32 to_max_digits = 0;
150
17
                UInt32 to_precision = 0;
151
17
                UInt32 to_scale = 0;
152
153
17
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
17
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
17
                    const auto* to_decimal_type =
157
17
                            check_and_get_data_type<ToDataType>(to_type.get());
158
17
                    to_precision = to_decimal_type->get_precision();
159
17
                    ToDataType::check_type_precision(to_precision);
160
161
17
                    to_scale = to_decimal_type->get_scale();
162
17
                    ToDataType::check_type_scale(to_scale);
163
17
                }
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
17
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
17
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
17
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
17
                if (to_scale > from_scale) {
174
16
                    multiply_may_overflow &=
175
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
16
                }
177
17
                return narrow_integral || multiply_may_overflow;
178
17
            }
179
0
            return false;
180
17
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
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
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
                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
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
                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
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
59
                    multiply_may_overflow &=
175
59
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
59
                }
177
72
                return narrow_integral || multiply_may_overflow;
178
72
            }
179
0
            return false;
180
72
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
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
38
                    multiply_may_overflow &=
175
38
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
38
                }
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_5EEESE_EEEEbSI_
Line
Count
Source
127
482
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
482
            using Types2 = std::decay_t<decltype(types2)>;
129
482
            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
482
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
482
                using FromFieldType = typename FromDataType::FieldType;
137
482
                using ToFieldType = typename ToDataType::FieldType;
138
482
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
482
                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
482
                UInt32 to_max_digits = 0;
150
482
                UInt32 to_precision = 0;
151
482
                UInt32 to_scale = 0;
152
153
482
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
482
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
482
                    const auto* to_decimal_type =
157
482
                            check_and_get_data_type<ToDataType>(to_type.get());
158
482
                    to_precision = to_decimal_type->get_precision();
159
482
                    ToDataType::check_type_precision(to_precision);
160
161
482
                    to_scale = to_decimal_type->get_scale();
162
482
                    ToDataType::check_type_scale(to_scale);
163
482
                }
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
482
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
482
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
482
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
482
                if (to_scale > from_scale) {
174
331
                    multiply_may_overflow &=
175
331
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
331
                }
177
482
                return narrow_integral || multiply_may_overflow;
178
482
            }
179
0
            return false;
180
482
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
127
52
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
52
            using Types2 = std::decay_t<decltype(types2)>;
129
52
            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
52
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
52
                using FromFieldType = typename FromDataType::FieldType;
137
52
                using ToFieldType = typename ToDataType::FieldType;
138
52
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
52
                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
52
                UInt32 to_max_digits = 0;
150
52
                UInt32 to_precision = 0;
151
52
                UInt32 to_scale = 0;
152
153
52
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
52
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
52
                    const auto* to_decimal_type =
157
52
                            check_and_get_data_type<ToDataType>(to_type.get());
158
52
                    to_precision = to_decimal_type->get_precision();
159
52
                    ToDataType::check_type_precision(to_precision);
160
161
52
                    to_scale = to_decimal_type->get_scale();
162
52
                    ToDataType::check_type_scale(to_scale);
163
52
                }
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
52
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
52
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
52
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
52
                if (to_scale > from_scale) {
174
31
                    multiply_may_overflow &=
175
31
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
31
                }
177
52
                return narrow_integral || multiply_may_overflow;
178
52
            }
179
0
            return false;
180
52
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
127
65
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
65
            using Types2 = std::decay_t<decltype(types2)>;
129
65
            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
65
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
65
                using FromFieldType = typename FromDataType::FieldType;
137
65
                using ToFieldType = typename ToDataType::FieldType;
138
65
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
65
                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
65
                UInt32 to_max_digits = 0;
150
65
                UInt32 to_precision = 0;
151
65
                UInt32 to_scale = 0;
152
153
65
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
65
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
65
                    const auto* to_decimal_type =
157
65
                            check_and_get_data_type<ToDataType>(to_type.get());
158
65
                    to_precision = to_decimal_type->get_precision();
159
65
                    ToDataType::check_type_precision(to_precision);
160
161
65
                    to_scale = to_decimal_type->get_scale();
162
65
                    ToDataType::check_type_scale(to_scale);
163
65
                }
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
65
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
65
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
65
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
65
                if (to_scale > from_scale) {
174
39
                    multiply_may_overflow &=
175
39
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
39
                }
177
65
                return narrow_integral || multiply_may_overflow;
178
65
            }
179
0
            return false;
180
65
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
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
65
                    multiply_may_overflow &=
175
65
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
65
                }
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_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
210
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
210
            using Types2 = std::decay_t<decltype(types2)>;
129
210
            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
210
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
210
                using FromFieldType = typename FromDataType::FieldType;
137
210
                using ToFieldType = typename ToDataType::FieldType;
138
210
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
210
                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
210
                UInt32 to_max_digits = 0;
150
210
                UInt32 to_precision = 0;
151
210
                UInt32 to_scale = 0;
152
153
210
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
210
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
210
                    const auto* to_decimal_type =
157
210
                            check_and_get_data_type<ToDataType>(to_type.get());
158
210
                    to_precision = to_decimal_type->get_precision();
159
210
                    ToDataType::check_type_precision(to_precision);
160
161
210
                    to_scale = to_decimal_type->get_scale();
162
210
                    ToDataType::check_type_scale(to_scale);
163
210
                }
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
210
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
210
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
210
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
210
                if (to_scale > from_scale) {
174
177
                    multiply_may_overflow &=
175
177
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
177
                }
177
210
                return narrow_integral || multiply_may_overflow;
178
210
            }
179
0
            return false;
180
210
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
127
1.11k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.11k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.11k
            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.11k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.11k
                using FromFieldType = typename FromDataType::FieldType;
137
1.11k
                using ToFieldType = typename ToDataType::FieldType;
138
1.11k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.11k
                UInt32 from_scale = 0;
140
141
1.11k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.11k
                    const auto* from_decimal_type =
143
1.11k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.11k
                    from_precision =
145
1.11k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.11k
                    from_scale = from_decimal_type->get_scale();
147
1.11k
                }
148
149
1.11k
                UInt32 to_max_digits = 0;
150
1.11k
                UInt32 to_precision = 0;
151
1.11k
                UInt32 to_scale = 0;
152
153
1.11k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.11k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.11k
                    const auto* to_decimal_type =
157
1.11k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.11k
                    to_precision = to_decimal_type->get_precision();
159
1.11k
                    ToDataType::check_type_precision(to_precision);
160
161
1.11k
                    to_scale = to_decimal_type->get_scale();
162
1.11k
                    ToDataType::check_type_scale(to_scale);
163
1.11k
                }
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.11k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.11k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.11k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.11k
                if (to_scale > from_scale) {
174
771
                    multiply_may_overflow &=
175
771
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
771
                }
177
1.11k
                return narrow_integral || multiply_may_overflow;
178
1.11k
            }
179
0
            return false;
180
1.11k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
127
875
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
875
            using Types2 = std::decay_t<decltype(types2)>;
129
875
            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
875
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
875
                using FromFieldType = typename FromDataType::FieldType;
137
875
                using ToFieldType = typename ToDataType::FieldType;
138
875
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
875
                UInt32 from_scale = 0;
140
141
875
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
875
                    const auto* from_decimal_type =
143
875
                            check_and_get_data_type<FromDataType>(from_type.get());
144
875
                    from_precision =
145
875
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
875
                    from_scale = from_decimal_type->get_scale();
147
875
                }
148
149
875
                UInt32 to_max_digits = 0;
150
875
                UInt32 to_precision = 0;
151
875
                UInt32 to_scale = 0;
152
153
875
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
875
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
875
                    const auto* to_decimal_type =
157
875
                            check_and_get_data_type<ToDataType>(to_type.get());
158
875
                    to_precision = to_decimal_type->get_precision();
159
875
                    ToDataType::check_type_precision(to_precision);
160
161
875
                    to_scale = to_decimal_type->get_scale();
162
875
                    ToDataType::check_type_scale(to_scale);
163
875
                }
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
875
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
875
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
875
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
875
                if (to_scale > from_scale) {
174
159
                    multiply_may_overflow &=
175
159
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
159
                }
177
875
                return narrow_integral || multiply_may_overflow;
178
875
            }
179
0
            return false;
180
875
        });
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
254
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
254
            using Types2 = std::decay_t<decltype(types2)>;
129
254
            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
254
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
254
                using FromFieldType = typename FromDataType::FieldType;
137
254
                using ToFieldType = typename ToDataType::FieldType;
138
254
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
254
                UInt32 from_scale = 0;
140
141
254
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
254
                    const auto* from_decimal_type =
143
254
                            check_and_get_data_type<FromDataType>(from_type.get());
144
254
                    from_precision =
145
254
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
254
                    from_scale = from_decimal_type->get_scale();
147
254
                }
148
149
254
                UInt32 to_max_digits = 0;
150
254
                UInt32 to_precision = 0;
151
254
                UInt32 to_scale = 0;
152
153
254
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
254
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
254
                    const auto* to_decimal_type =
157
254
                            check_and_get_data_type<ToDataType>(to_type.get());
158
254
                    to_precision = to_decimal_type->get_precision();
159
254
                    ToDataType::check_type_precision(to_precision);
160
161
254
                    to_scale = to_decimal_type->get_scale();
162
254
                    ToDataType::check_type_scale(to_scale);
163
254
                }
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
254
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
254
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
254
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
254
                if (to_scale > from_scale) {
174
50
                    multiply_may_overflow &=
175
50
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
50
                }
177
254
                return narrow_integral || multiply_may_overflow;
178
254
            }
179
0
            return false;
180
254
        });
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
421
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
421
            using Types2 = std::decay_t<decltype(types2)>;
129
421
            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
421
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
421
                using FromFieldType = typename FromDataType::FieldType;
137
421
                using ToFieldType = typename ToDataType::FieldType;
138
421
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
421
                UInt32 from_scale = 0;
140
141
421
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
421
                    const auto* from_decimal_type =
143
421
                            check_and_get_data_type<FromDataType>(from_type.get());
144
421
                    from_precision =
145
421
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
421
                    from_scale = from_decimal_type->get_scale();
147
421
                }
148
149
421
                UInt32 to_max_digits = 0;
150
421
                UInt32 to_precision = 0;
151
421
                UInt32 to_scale = 0;
152
153
421
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
421
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
421
                    const auto* to_decimal_type =
157
421
                            check_and_get_data_type<ToDataType>(to_type.get());
158
421
                    to_precision = to_decimal_type->get_precision();
159
421
                    ToDataType::check_type_precision(to_precision);
160
161
421
                    to_scale = to_decimal_type->get_scale();
162
421
                    ToDataType::check_type_scale(to_scale);
163
421
                }
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
421
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
421
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
421
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
421
                if (to_scale > from_scale) {
174
144
                    multiply_may_overflow &=
175
144
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
144
                }
177
421
                return narrow_integral || multiply_may_overflow;
178
421
            }
179
0
            return false;
180
421
        });
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
401
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
401
            using Types2 = std::decay_t<decltype(types2)>;
129
401
            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
401
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
401
                using FromFieldType = typename FromDataType::FieldType;
137
401
                using ToFieldType = typename ToDataType::FieldType;
138
401
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
401
                UInt32 from_scale = 0;
140
141
401
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
401
                    const auto* from_decimal_type =
143
401
                            check_and_get_data_type<FromDataType>(from_type.get());
144
401
                    from_precision =
145
401
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
401
                    from_scale = from_decimal_type->get_scale();
147
401
                }
148
149
401
                UInt32 to_max_digits = 0;
150
401
                UInt32 to_precision = 0;
151
401
                UInt32 to_scale = 0;
152
153
401
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
401
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
401
                    const auto* to_decimal_type =
157
401
                            check_and_get_data_type<ToDataType>(to_type.get());
158
401
                    to_precision = to_decimal_type->get_precision();
159
401
                    ToDataType::check_type_precision(to_precision);
160
161
401
                    to_scale = to_decimal_type->get_scale();
162
401
                    ToDataType::check_type_scale(to_scale);
163
401
                }
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
401
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
401
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
401
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
401
                if (to_scale > from_scale) {
174
137
                    multiply_may_overflow &=
175
137
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
137
                }
177
401
                return narrow_integral || multiply_may_overflow;
178
401
            }
179
0
            return false;
180
401
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
127
7.85k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.85k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.85k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
7.85k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
7.85k
                return false;
134
7.85k
            }
135
7.85k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7.85k
                using FromFieldType = typename FromDataType::FieldType;
137
7.85k
                using ToFieldType = typename ToDataType::FieldType;
138
7.85k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7.85k
                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.85k
                UInt32 to_max_digits = 0;
150
7.85k
                UInt32 to_precision = 0;
151
7.85k
                UInt32 to_scale = 0;
152
153
7.85k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7.85k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7.85k
                    const auto* to_decimal_type =
157
7.85k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7.85k
                    to_precision = to_decimal_type->get_precision();
159
7.85k
                    ToDataType::check_type_precision(to_precision);
160
161
7.85k
                    to_scale = to_decimal_type->get_scale();
162
7.85k
                    ToDataType::check_type_scale(to_scale);
163
7.85k
                }
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.85k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7.85k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7.85k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7.85k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
7.85k
                return narrow_integral || multiply_may_overflow;
178
7.85k
            }
179
0
            return false;
180
7.85k
        });
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
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
20
            using Types2 = std::decay_t<decltype(types2)>;
129
20
            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
20
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
20
                using FromFieldType = typename FromDataType::FieldType;
137
20
                using ToFieldType = typename ToDataType::FieldType;
138
20
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
20
                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
20
                UInt32 to_max_digits = 0;
150
20
                UInt32 to_precision = 0;
151
20
                UInt32 to_scale = 0;
152
153
20
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
20
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
20
                    const auto* to_decimal_type =
157
20
                            check_and_get_data_type<ToDataType>(to_type.get());
158
20
                    to_precision = to_decimal_type->get_precision();
159
20
                    ToDataType::check_type_precision(to_precision);
160
161
20
                    to_scale = to_decimal_type->get_scale();
162
20
                    ToDataType::check_type_scale(to_scale);
163
20
                }
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
20
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
20
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
20
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
20
                if (to_scale > from_scale) {
174
20
                    multiply_may_overflow &=
175
20
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
20
                }
177
20
                return narrow_integral || multiply_may_overflow;
178
20
            }
179
0
            return false;
180
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
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
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
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
                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
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
                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
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
0
            return false;
180
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
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
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
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
                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
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
                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
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
0
            return false;
180
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
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
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
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
                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
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
                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
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
0
            return false;
180
16
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
32
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
32
            using Types2 = std::decay_t<decltype(types2)>;
129
32
            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
32
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
32
                using FromFieldType = typename FromDataType::FieldType;
137
32
                using ToFieldType = typename ToDataType::FieldType;
138
32
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
32
                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
32
                UInt32 to_max_digits = 0;
150
32
                UInt32 to_precision = 0;
151
32
                UInt32 to_scale = 0;
152
153
32
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
32
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
32
                    const auto* to_decimal_type =
157
32
                            check_and_get_data_type<ToDataType>(to_type.get());
158
32
                    to_precision = to_decimal_type->get_precision();
159
32
                    ToDataType::check_type_precision(to_precision);
160
161
32
                    to_scale = to_decimal_type->get_scale();
162
32
                    ToDataType::check_type_scale(to_scale);
163
32
                }
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
32
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
32
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
32
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
32
                if (to_scale > from_scale) {
174
32
                    multiply_may_overflow &=
175
32
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
32
                }
177
32
                return narrow_integral || multiply_may_overflow;
178
32
            }
179
0
            return false;
180
32
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
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
                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
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
128
                    multiply_may_overflow &=
175
128
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
128
                }
177
128
                return narrow_integral || multiply_may_overflow;
178
128
            }
179
0
            return false;
180
128
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
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
1
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1
                return false;
134
1
            }
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
                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
                UInt32 to_max_digits = 0;
150
1
                UInt32 to_precision = 0;
151
1
                UInt32 to_scale = 0;
152
153
1
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1
                    const auto* to_decimal_type =
157
1
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1
                    to_precision = to_decimal_type->get_precision();
159
1
                    ToDataType::check_type_precision(to_precision);
160
161
1
                    to_scale = to_decimal_type->get_scale();
162
1
                    ToDataType::check_type_scale(to_scale);
163
1
                }
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
                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
        });
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
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
23
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
23
                using FromFieldType = typename FromDataType::FieldType;
137
23
                using ToFieldType = typename ToDataType::FieldType;
138
23
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
23
                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
23
                UInt32 to_max_digits = 0;
150
23
                UInt32 to_precision = 0;
151
23
                UInt32 to_scale = 0;
152
153
23
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
23
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
23
                    const auto* to_decimal_type =
157
23
                            check_and_get_data_type<ToDataType>(to_type.get());
158
23
                    to_precision = to_decimal_type->get_precision();
159
23
                    ToDataType::check_type_precision(to_precision);
160
161
23
                    to_scale = to_decimal_type->get_scale();
162
23
                    ToDataType::check_type_scale(to_scale);
163
23
                }
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
23
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
23
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
23
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
23
                if (to_scale > from_scale) {
174
22
                    multiply_may_overflow &=
175
22
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
22
                }
177
23
                return narrow_integral || multiply_may_overflow;
178
23
            }
179
0
            return false;
180
23
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
179
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
179
            using Types2 = std::decay_t<decltype(types2)>;
129
179
            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
179
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
179
                using FromFieldType = typename FromDataType::FieldType;
137
179
                using ToFieldType = typename ToDataType::FieldType;
138
179
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
179
                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
179
                UInt32 to_max_digits = 0;
150
179
                UInt32 to_precision = 0;
151
179
                UInt32 to_scale = 0;
152
153
179
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
179
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
179
                    const auto* to_decimal_type =
157
179
                            check_and_get_data_type<ToDataType>(to_type.get());
158
179
                    to_precision = to_decimal_type->get_precision();
159
179
                    ToDataType::check_type_precision(to_precision);
160
161
179
                    to_scale = to_decimal_type->get_scale();
162
179
                    ToDataType::check_type_scale(to_scale);
163
179
                }
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
179
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
179
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
179
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
179
                if (to_scale > from_scale) {
174
128
                    multiply_may_overflow &=
175
128
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
128
                }
177
179
                return narrow_integral || multiply_may_overflow;
178
179
            }
179
0
            return false;
180
179
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
127
166
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
166
            using Types2 = std::decay_t<decltype(types2)>;
129
166
            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
166
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
166
                using FromFieldType = typename FromDataType::FieldType;
137
166
                using ToFieldType = typename ToDataType::FieldType;
138
166
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
166
                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
166
                UInt32 to_max_digits = 0;
150
166
                UInt32 to_precision = 0;
151
166
                UInt32 to_scale = 0;
152
153
166
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
166
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
166
                    const auto* to_decimal_type =
157
166
                            check_and_get_data_type<ToDataType>(to_type.get());
158
166
                    to_precision = to_decimal_type->get_precision();
159
166
                    ToDataType::check_type_precision(to_precision);
160
161
166
                    to_scale = to_decimal_type->get_scale();
162
166
                    ToDataType::check_type_scale(to_scale);
163
166
                }
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
166
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
166
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
166
                if (to_scale > from_scale) {
174
115
                    multiply_may_overflow &=
175
115
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
115
                }
177
166
                return narrow_integral || multiply_may_overflow;
178
166
            }
179
0
            return false;
180
166
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
424
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
424
            using Types2 = std::decay_t<decltype(types2)>;
129
424
            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
424
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
424
                using FromFieldType = typename FromDataType::FieldType;
137
424
                using ToFieldType = typename ToDataType::FieldType;
138
424
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
424
                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
424
                UInt32 to_max_digits = 0;
150
424
                UInt32 to_precision = 0;
151
424
                UInt32 to_scale = 0;
152
153
424
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
424
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
424
                    const auto* to_decimal_type =
157
424
                            check_and_get_data_type<ToDataType>(to_type.get());
158
424
                    to_precision = to_decimal_type->get_precision();
159
424
                    ToDataType::check_type_precision(to_precision);
160
161
424
                    to_scale = to_decimal_type->get_scale();
162
424
                    ToDataType::check_type_scale(to_scale);
163
424
                }
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
424
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
424
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
424
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
424
                if (to_scale > from_scale) {
174
368
                    multiply_may_overflow &=
175
368
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
368
                }
177
424
                return narrow_integral || multiply_may_overflow;
178
424
            }
179
0
            return false;
180
424
        });
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
1.83k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.83k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.83k
            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.83k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.83k
                using FromFieldType = typename FromDataType::FieldType;
137
1.83k
                using ToFieldType = typename ToDataType::FieldType;
138
1.83k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.83k
                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.83k
                UInt32 to_max_digits = 0;
150
1.83k
                UInt32 to_precision = 0;
151
1.83k
                UInt32 to_scale = 0;
152
153
1.83k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.83k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.83k
                    const auto* to_decimal_type =
157
1.83k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.83k
                    to_precision = to_decimal_type->get_precision();
159
1.83k
                    ToDataType::check_type_precision(to_precision);
160
161
1.83k
                    to_scale = to_decimal_type->get_scale();
162
1.83k
                    ToDataType::check_type_scale(to_scale);
163
1.83k
                }
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.83k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.83k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.83k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.83k
                if (to_scale > from_scale) {
174
432
                    multiply_may_overflow &=
175
432
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
432
                }
177
1.83k
                return narrow_integral || multiply_may_overflow;
178
1.83k
            }
179
0
            return false;
180
1.83k
        });
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
367
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
367
            using Types2 = std::decay_t<decltype(types2)>;
129
367
            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
367
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
367
                using FromFieldType = typename FromDataType::FieldType;
137
367
                using ToFieldType = typename ToDataType::FieldType;
138
367
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
367
                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
367
                UInt32 to_max_digits = 0;
150
367
                UInt32 to_precision = 0;
151
367
                UInt32 to_scale = 0;
152
153
367
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
367
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
367
                    const auto* to_decimal_type =
157
367
                            check_and_get_data_type<ToDataType>(to_type.get());
158
367
                    to_precision = to_decimal_type->get_precision();
159
367
                    ToDataType::check_type_precision(to_precision);
160
161
367
                    to_scale = to_decimal_type->get_scale();
162
367
                    ToDataType::check_type_scale(to_scale);
163
367
                }
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
367
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
367
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
367
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
367
                if (to_scale > from_scale) {
174
196
                    multiply_may_overflow &=
175
196
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
196
                }
177
367
                return narrow_integral || multiply_may_overflow;
178
367
            }
179
0
            return false;
180
367
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
248
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
248
            using Types2 = std::decay_t<decltype(types2)>;
129
248
            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
248
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
248
                using FromFieldType = typename FromDataType::FieldType;
137
248
                using ToFieldType = typename ToDataType::FieldType;
138
248
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
248
                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
248
                UInt32 to_max_digits = 0;
150
248
                UInt32 to_precision = 0;
151
248
                UInt32 to_scale = 0;
152
153
248
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
248
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
248
                    const auto* to_decimal_type =
157
248
                            check_and_get_data_type<ToDataType>(to_type.get());
158
248
                    to_precision = to_decimal_type->get_precision();
159
248
                    ToDataType::check_type_precision(to_precision);
160
161
248
                    to_scale = to_decimal_type->get_scale();
162
248
                    ToDataType::check_type_scale(to_scale);
163
248
                }
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
248
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
248
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
248
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
248
                if (to_scale > from_scale) {
174
130
                    multiply_may_overflow &=
175
130
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
130
                }
177
248
                return narrow_integral || multiply_may_overflow;
178
248
            }
179
0
            return false;
180
248
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
489
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
489
            using Types2 = std::decay_t<decltype(types2)>;
129
489
            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
489
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
489
                using FromFieldType = typename FromDataType::FieldType;
137
489
                using ToFieldType = typename ToDataType::FieldType;
138
489
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
489
                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
489
                UInt32 to_max_digits = 0;
150
489
                UInt32 to_precision = 0;
151
489
                UInt32 to_scale = 0;
152
153
489
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
489
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
489
                    const auto* to_decimal_type =
157
489
                            check_and_get_data_type<ToDataType>(to_type.get());
158
489
                    to_precision = to_decimal_type->get_precision();
159
489
                    ToDataType::check_type_precision(to_precision);
160
161
489
                    to_scale = to_decimal_type->get_scale();
162
489
                    ToDataType::check_type_scale(to_scale);
163
489
                }
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
489
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
489
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
489
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
489
                if (to_scale > from_scale) {
174
379
                    multiply_may_overflow &=
175
379
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
379
                }
177
489
                return narrow_integral || multiply_may_overflow;
178
489
            }
179
0
            return false;
180
489
        });
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
759
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
759
            using Types2 = std::decay_t<decltype(types2)>;
129
759
            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
759
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
759
                using FromFieldType = typename FromDataType::FieldType;
137
759
                using ToFieldType = typename ToDataType::FieldType;
138
759
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
759
                UInt32 from_scale = 0;
140
141
759
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
759
                    const auto* from_decimal_type =
143
759
                            check_and_get_data_type<FromDataType>(from_type.get());
144
759
                    from_precision =
145
759
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
759
                    from_scale = from_decimal_type->get_scale();
147
759
                }
148
149
759
                UInt32 to_max_digits = 0;
150
759
                UInt32 to_precision = 0;
151
759
                UInt32 to_scale = 0;
152
153
759
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
759
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
759
                    const auto* to_decimal_type =
157
759
                            check_and_get_data_type<ToDataType>(to_type.get());
158
759
                    to_precision = to_decimal_type->get_precision();
159
759
                    ToDataType::check_type_precision(to_precision);
160
161
759
                    to_scale = to_decimal_type->get_scale();
162
759
                    ToDataType::check_type_scale(to_scale);
163
759
                }
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
759
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
759
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
759
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
759
                if (to_scale > from_scale) {
174
606
                    multiply_may_overflow &=
175
606
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
606
                }
177
759
                return narrow_integral || multiply_may_overflow;
178
759
            }
179
0
            return false;
180
759
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
1.06k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.06k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.06k
            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.06k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.06k
                using FromFieldType = typename FromDataType::FieldType;
137
1.06k
                using ToFieldType = typename ToDataType::FieldType;
138
1.06k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.06k
                UInt32 from_scale = 0;
140
141
1.06k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.06k
                    const auto* from_decimal_type =
143
1.06k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.06k
                    from_precision =
145
1.06k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.06k
                    from_scale = from_decimal_type->get_scale();
147
1.06k
                }
148
149
1.06k
                UInt32 to_max_digits = 0;
150
1.06k
                UInt32 to_precision = 0;
151
1.06k
                UInt32 to_scale = 0;
152
153
1.06k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.06k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.06k
                    const auto* to_decimal_type =
157
1.06k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.06k
                    to_precision = to_decimal_type->get_precision();
159
1.06k
                    ToDataType::check_type_precision(to_precision);
160
161
1.06k
                    to_scale = to_decimal_type->get_scale();
162
1.06k
                    ToDataType::check_type_scale(to_scale);
163
1.06k
                }
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.06k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.06k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.06k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.06k
                if (to_scale > from_scale) {
174
719
                    multiply_may_overflow &=
175
719
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
719
                }
177
1.06k
                return narrow_integral || multiply_may_overflow;
178
1.06k
            }
179
0
            return false;
180
1.06k
        });
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
292
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
292
            using Types2 = std::decay_t<decltype(types2)>;
129
292
            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
292
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
292
                using FromFieldType = typename FromDataType::FieldType;
137
292
                using ToFieldType = typename ToDataType::FieldType;
138
292
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
292
                UInt32 from_scale = 0;
140
141
292
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
292
                    const auto* from_decimal_type =
143
292
                            check_and_get_data_type<FromDataType>(from_type.get());
144
292
                    from_precision =
145
292
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
292
                    from_scale = from_decimal_type->get_scale();
147
292
                }
148
149
292
                UInt32 to_max_digits = 0;
150
292
                UInt32 to_precision = 0;
151
292
                UInt32 to_scale = 0;
152
153
292
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
292
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
292
                    const auto* to_decimal_type =
157
292
                            check_and_get_data_type<ToDataType>(to_type.get());
158
292
                    to_precision = to_decimal_type->get_precision();
159
292
                    ToDataType::check_type_precision(to_precision);
160
161
292
                    to_scale = to_decimal_type->get_scale();
162
292
                    ToDataType::check_type_scale(to_scale);
163
292
                }
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
292
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
292
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
292
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
292
                if (to_scale > from_scale) {
174
71
                    multiply_may_overflow &=
175
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
71
                }
177
292
                return narrow_integral || multiply_may_overflow;
178
292
            }
179
0
            return false;
180
292
        });
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
1.37k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.37k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.37k
            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.37k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.37k
                using FromFieldType = typename FromDataType::FieldType;
137
1.37k
                using ToFieldType = typename ToDataType::FieldType;
138
1.37k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.37k
                UInt32 from_scale = 0;
140
141
1.37k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.37k
                    const auto* from_decimal_type =
143
1.37k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.37k
                    from_precision =
145
1.37k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.37k
                    from_scale = from_decimal_type->get_scale();
147
1.37k
                }
148
149
1.37k
                UInt32 to_max_digits = 0;
150
1.37k
                UInt32 to_precision = 0;
151
1.37k
                UInt32 to_scale = 0;
152
153
1.37k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.37k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.37k
                    const auto* to_decimal_type =
157
1.37k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.37k
                    to_precision = to_decimal_type->get_precision();
159
1.37k
                    ToDataType::check_type_precision(to_precision);
160
161
1.37k
                    to_scale = to_decimal_type->get_scale();
162
1.37k
                    ToDataType::check_type_scale(to_scale);
163
1.37k
                }
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.37k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.37k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.37k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.37k
                if (to_scale > from_scale) {
174
714
                    multiply_may_overflow &=
175
714
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
714
                }
177
1.37k
                return narrow_integral || multiply_may_overflow;
178
1.37k
            }
179
0
            return false;
180
1.37k
        });
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
948
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
948
            using Types2 = std::decay_t<decltype(types2)>;
129
948
            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
948
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
948
                using FromFieldType = typename FromDataType::FieldType;
137
948
                using ToFieldType = typename ToDataType::FieldType;
138
948
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
948
                UInt32 from_scale = 0;
140
141
948
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
948
                    const auto* from_decimal_type =
143
948
                            check_and_get_data_type<FromDataType>(from_type.get());
144
948
                    from_precision =
145
948
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
948
                    from_scale = from_decimal_type->get_scale();
147
948
                }
148
149
948
                UInt32 to_max_digits = 0;
150
948
                UInt32 to_precision = 0;
151
948
                UInt32 to_scale = 0;
152
153
948
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
948
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
948
                    const auto* to_decimal_type =
157
948
                            check_and_get_data_type<ToDataType>(to_type.get());
158
948
                    to_precision = to_decimal_type->get_precision();
159
948
                    ToDataType::check_type_precision(to_precision);
160
161
948
                    to_scale = to_decimal_type->get_scale();
162
948
                    ToDataType::check_type_scale(to_scale);
163
948
                }
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
948
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
948
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
948
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
948
                if (to_scale > from_scale) {
174
394
                    multiply_may_overflow &=
175
394
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
394
                }
177
948
                return narrow_integral || multiply_may_overflow;
178
948
            }
179
0
            return false;
180
948
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
127
4.90k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4.90k
            using Types2 = std::decay_t<decltype(types2)>;
129
4.90k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
4.90k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
4.90k
                return false;
134
4.90k
            }
135
4.90k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
4.90k
                using FromFieldType = typename FromDataType::FieldType;
137
4.90k
                using ToFieldType = typename ToDataType::FieldType;
138
4.90k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
4.90k
                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.90k
                UInt32 to_max_digits = 0;
150
4.90k
                UInt32 to_precision = 0;
151
4.90k
                UInt32 to_scale = 0;
152
153
4.90k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
4.90k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
4.90k
                    const auto* to_decimal_type =
157
4.90k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
4.90k
                    to_precision = to_decimal_type->get_precision();
159
4.90k
                    ToDataType::check_type_precision(to_precision);
160
161
4.90k
                    to_scale = to_decimal_type->get_scale();
162
4.90k
                    ToDataType::check_type_scale(to_scale);
163
4.90k
                }
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.90k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
4.90k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
4.90k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
4.90k
                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.90k
                return narrow_integral || multiply_may_overflow;
178
4.90k
            }
179
0
            return false;
180
4.90k
        });
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
160
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
160
            using Types2 = std::decay_t<decltype(types2)>;
129
160
            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
160
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
160
                using FromFieldType = typename FromDataType::FieldType;
137
160
                using ToFieldType = typename ToDataType::FieldType;
138
160
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
160
                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
160
                UInt32 to_max_digits = 0;
150
160
                UInt32 to_precision = 0;
151
160
                UInt32 to_scale = 0;
152
153
160
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
160
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
160
                    const auto* to_decimal_type =
157
160
                            check_and_get_data_type<ToDataType>(to_type.get());
158
160
                    to_precision = to_decimal_type->get_precision();
159
160
                    ToDataType::check_type_precision(to_precision);
160
161
160
                    to_scale = to_decimal_type->get_scale();
162
160
                    ToDataType::check_type_scale(to_scale);
163
160
                }
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
160
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
160
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
160
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
160
                if (to_scale > from_scale) {
174
109
                    multiply_may_overflow &=
175
109
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
109
                }
177
160
                return narrow_integral || multiply_may_overflow;
178
160
            }
179
0
            return false;
180
160
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
127
158
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
158
            using Types2 = std::decay_t<decltype(types2)>;
129
158
            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
158
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
158
                using FromFieldType = typename FromDataType::FieldType;
137
158
                using ToFieldType = typename ToDataType::FieldType;
138
158
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
158
                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
158
                UInt32 to_max_digits = 0;
150
158
                UInt32 to_precision = 0;
151
158
                UInt32 to_scale = 0;
152
153
158
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
158
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
158
                    const auto* to_decimal_type =
157
158
                            check_and_get_data_type<ToDataType>(to_type.get());
158
158
                    to_precision = to_decimal_type->get_precision();
159
158
                    ToDataType::check_type_precision(to_precision);
160
161
158
                    to_scale = to_decimal_type->get_scale();
162
158
                    ToDataType::check_type_scale(to_scale);
163
158
                }
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
158
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
158
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
158
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
158
                if (to_scale > from_scale) {
174
107
                    multiply_may_overflow &=
175
107
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
107
                }
177
158
                return narrow_integral || multiply_may_overflow;
178
158
            }
179
0
            return false;
180
158
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
176
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
176
            using Types2 = std::decay_t<decltype(types2)>;
129
176
            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
176
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
176
                using FromFieldType = typename FromDataType::FieldType;
137
176
                using ToFieldType = typename ToDataType::FieldType;
138
176
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
176
                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
176
                UInt32 to_max_digits = 0;
150
176
                UInt32 to_precision = 0;
151
176
                UInt32 to_scale = 0;
152
153
176
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
176
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
176
                    const auto* to_decimal_type =
157
176
                            check_and_get_data_type<ToDataType>(to_type.get());
158
176
                    to_precision = to_decimal_type->get_precision();
159
176
                    ToDataType::check_type_precision(to_precision);
160
161
176
                    to_scale = to_decimal_type->get_scale();
162
176
                    ToDataType::check_type_scale(to_scale);
163
176
                }
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
176
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
176
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
176
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
176
                if (to_scale > from_scale) {
174
120
                    multiply_may_overflow &=
175
120
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
120
                }
177
176
                return narrow_integral || multiply_may_overflow;
178
176
            }
179
0
            return false;
180
176
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
127
158
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
158
            using Types2 = std::decay_t<decltype(types2)>;
129
158
            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
158
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
158
                using FromFieldType = typename FromDataType::FieldType;
137
158
                using ToFieldType = typename ToDataType::FieldType;
138
158
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
158
                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
158
                UInt32 to_max_digits = 0;
150
158
                UInt32 to_precision = 0;
151
158
                UInt32 to_scale = 0;
152
153
158
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
158
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
158
                    const auto* to_decimal_type =
157
158
                            check_and_get_data_type<ToDataType>(to_type.get());
158
158
                    to_precision = to_decimal_type->get_precision();
159
158
                    ToDataType::check_type_precision(to_precision);
160
161
158
                    to_scale = to_decimal_type->get_scale();
162
158
                    ToDataType::check_type_scale(to_scale);
163
158
                }
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
158
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
158
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
158
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
158
                if (to_scale > from_scale) {
174
107
                    multiply_may_overflow &=
175
107
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
107
                }
177
158
                return narrow_integral || multiply_may_overflow;
178
158
            }
179
0
            return false;
180
158
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
127
232
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
232
            using Types2 = std::decay_t<decltype(types2)>;
129
232
            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
232
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
232
                using FromFieldType = typename FromDataType::FieldType;
137
232
                using ToFieldType = typename ToDataType::FieldType;
138
232
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
232
                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
232
                UInt32 to_max_digits = 0;
150
232
                UInt32 to_precision = 0;
151
232
                UInt32 to_scale = 0;
152
153
232
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
232
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
232
                    const auto* to_decimal_type =
157
232
                            check_and_get_data_type<ToDataType>(to_type.get());
158
232
                    to_precision = to_decimal_type->get_precision();
159
232
                    ToDataType::check_type_precision(to_precision);
160
161
232
                    to_scale = to_decimal_type->get_scale();
162
232
                    ToDataType::check_type_scale(to_scale);
163
232
                }
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
232
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
232
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
232
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
232
                if (to_scale > from_scale) {
174
170
                    multiply_may_overflow &=
175
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
170
                }
177
232
                return narrow_integral || multiply_may_overflow;
178
232
            }
179
0
            return false;
180
232
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
224
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
224
            using Types2 = std::decay_t<decltype(types2)>;
129
224
            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
224
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
224
                using FromFieldType = typename FromDataType::FieldType;
137
224
                using ToFieldType = typename ToDataType::FieldType;
138
224
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
224
                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
224
                UInt32 to_max_digits = 0;
150
224
                UInt32 to_precision = 0;
151
224
                UInt32 to_scale = 0;
152
153
224
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
224
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
224
                    const auto* to_decimal_type =
157
224
                            check_and_get_data_type<ToDataType>(to_type.get());
158
224
                    to_precision = to_decimal_type->get_precision();
159
224
                    ToDataType::check_type_precision(to_precision);
160
161
224
                    to_scale = to_decimal_type->get_scale();
162
224
                    ToDataType::check_type_scale(to_scale);
163
224
                }
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
224
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
224
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
224
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
224
                if (to_scale > from_scale) {
174
126
                    multiply_may_overflow &=
175
126
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
126
                }
177
224
                return narrow_integral || multiply_may_overflow;
178
224
            }
179
0
            return false;
180
224
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
318
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
318
            using Types2 = std::decay_t<decltype(types2)>;
129
318
            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
318
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
318
                using FromFieldType = typename FromDataType::FieldType;
137
318
                using ToFieldType = typename ToDataType::FieldType;
138
318
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
318
                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
318
                UInt32 to_max_digits = 0;
150
318
                UInt32 to_precision = 0;
151
318
                UInt32 to_scale = 0;
152
153
318
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
318
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
318
                    const auto* to_decimal_type =
157
318
                            check_and_get_data_type<ToDataType>(to_type.get());
158
318
                    to_precision = to_decimal_type->get_precision();
159
318
                    ToDataType::check_type_precision(to_precision);
160
161
318
                    to_scale = to_decimal_type->get_scale();
162
318
                    ToDataType::check_type_scale(to_scale);
163
318
                }
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
318
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
318
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
318
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
318
                if (to_scale > from_scale) {
174
208
                    multiply_may_overflow &=
175
208
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
208
                }
177
318
                return narrow_integral || multiply_may_overflow;
178
318
            }
179
0
            return false;
180
318
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
127
567
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
567
            using Types2 = std::decay_t<decltype(types2)>;
129
567
            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
567
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
567
                using FromFieldType = typename FromDataType::FieldType;
137
567
                using ToFieldType = typename ToDataType::FieldType;
138
567
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
567
                UInt32 from_scale = 0;
140
141
567
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
567
                    const auto* from_decimal_type =
143
567
                            check_and_get_data_type<FromDataType>(from_type.get());
144
567
                    from_precision =
145
567
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
567
                    from_scale = from_decimal_type->get_scale();
147
567
                }
148
149
567
                UInt32 to_max_digits = 0;
150
567
                UInt32 to_precision = 0;
151
567
                UInt32 to_scale = 0;
152
153
567
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
567
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
567
                    const auto* to_decimal_type =
157
567
                            check_and_get_data_type<ToDataType>(to_type.get());
158
567
                    to_precision = to_decimal_type->get_precision();
159
567
                    ToDataType::check_type_precision(to_precision);
160
161
567
                    to_scale = to_decimal_type->get_scale();
162
567
                    ToDataType::check_type_scale(to_scale);
163
567
                }
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
567
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
567
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
567
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
567
                if (to_scale > from_scale) {
174
499
                    multiply_may_overflow &=
175
499
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
499
                }
177
567
                return narrow_integral || multiply_may_overflow;
178
567
            }
179
0
            return false;
180
567
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
919
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
919
            using Types2 = std::decay_t<decltype(types2)>;
129
919
            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
919
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
919
                using FromFieldType = typename FromDataType::FieldType;
137
919
                using ToFieldType = typename ToDataType::FieldType;
138
919
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
919
                UInt32 from_scale = 0;
140
141
919
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
919
                    const auto* from_decimal_type =
143
919
                            check_and_get_data_type<FromDataType>(from_type.get());
144
919
                    from_precision =
145
919
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
919
                    from_scale = from_decimal_type->get_scale();
147
919
                }
148
149
919
                UInt32 to_max_digits = 0;
150
919
                UInt32 to_precision = 0;
151
919
                UInt32 to_scale = 0;
152
153
919
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
919
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
919
                    const auto* to_decimal_type =
157
919
                            check_and_get_data_type<ToDataType>(to_type.get());
158
919
                    to_precision = to_decimal_type->get_precision();
159
919
                    ToDataType::check_type_precision(to_precision);
160
161
919
                    to_scale = to_decimal_type->get_scale();
162
919
                    ToDataType::check_type_scale(to_scale);
163
919
                }
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
919
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
919
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
919
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
919
                if (to_scale > from_scale) {
174
792
                    multiply_may_overflow &=
175
792
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
792
                }
177
919
                return narrow_integral || multiply_may_overflow;
178
919
            }
179
0
            return false;
180
919
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
127
148
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
148
            using Types2 = std::decay_t<decltype(types2)>;
129
148
            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
148
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
148
                using FromFieldType = typename FromDataType::FieldType;
137
148
                using ToFieldType = typename ToDataType::FieldType;
138
148
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
148
                UInt32 from_scale = 0;
140
141
148
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
148
                    const auto* from_decimal_type =
143
148
                            check_and_get_data_type<FromDataType>(from_type.get());
144
148
                    from_precision =
145
148
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
148
                    from_scale = from_decimal_type->get_scale();
147
148
                }
148
149
148
                UInt32 to_max_digits = 0;
150
148
                UInt32 to_precision = 0;
151
148
                UInt32 to_scale = 0;
152
153
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
148
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
148
                    const auto* to_decimal_type =
157
148
                            check_and_get_data_type<ToDataType>(to_type.get());
158
148
                    to_precision = to_decimal_type->get_precision();
159
148
                    ToDataType::check_type_precision(to_precision);
160
161
148
                    to_scale = to_decimal_type->get_scale();
162
148
                    ToDataType::check_type_scale(to_scale);
163
148
                }
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
148
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
148
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
148
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
148
                if (to_scale > from_scale) {
174
84
                    multiply_may_overflow &=
175
84
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
84
                }
177
148
                return narrow_integral || multiply_may_overflow;
178
148
            }
179
0
            return false;
180
148
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
127
1.23k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.23k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.23k
            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.23k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.23k
                using FromFieldType = typename FromDataType::FieldType;
137
1.23k
                using ToFieldType = typename ToDataType::FieldType;
138
1.23k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.23k
                UInt32 from_scale = 0;
140
141
1.23k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.23k
                    const auto* from_decimal_type =
143
1.23k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.23k
                    from_precision =
145
1.23k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.23k
                    from_scale = from_decimal_type->get_scale();
147
1.23k
                }
148
149
1.23k
                UInt32 to_max_digits = 0;
150
1.23k
                UInt32 to_precision = 0;
151
1.23k
                UInt32 to_scale = 0;
152
153
1.23k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.23k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.23k
                    const auto* to_decimal_type =
157
1.23k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.23k
                    to_precision = to_decimal_type->get_precision();
159
1.23k
                    ToDataType::check_type_precision(to_precision);
160
161
1.23k
                    to_scale = to_decimal_type->get_scale();
162
1.23k
                    ToDataType::check_type_scale(to_scale);
163
1.23k
                }
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.23k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.23k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.23k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.23k
                if (to_scale > from_scale) {
174
742
                    multiply_may_overflow &=
175
742
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
742
                }
177
1.23k
                return narrow_integral || multiply_may_overflow;
178
1.23k
            }
179
0
            return false;
180
1.23k
        });
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
934
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
934
            using Types2 = std::decay_t<decltype(types2)>;
129
934
            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
934
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
934
                using FromFieldType = typename FromDataType::FieldType;
137
934
                using ToFieldType = typename ToDataType::FieldType;
138
934
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
934
                UInt32 from_scale = 0;
140
141
934
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
934
                    const auto* from_decimal_type =
143
934
                            check_and_get_data_type<FromDataType>(from_type.get());
144
934
                    from_precision =
145
934
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
934
                    from_scale = from_decimal_type->get_scale();
147
934
                }
148
149
934
                UInt32 to_max_digits = 0;
150
934
                UInt32 to_precision = 0;
151
934
                UInt32 to_scale = 0;
152
153
934
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
934
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
934
                    const auto* to_decimal_type =
157
934
                            check_and_get_data_type<ToDataType>(to_type.get());
158
934
                    to_precision = to_decimal_type->get_precision();
159
934
                    ToDataType::check_type_precision(to_precision);
160
161
934
                    to_scale = to_decimal_type->get_scale();
162
934
                    ToDataType::check_type_scale(to_scale);
163
934
                }
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
934
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
934
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
934
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
934
                if (to_scale > from_scale) {
174
453
                    multiply_may_overflow &=
175
453
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
453
                }
177
934
                return narrow_integral || multiply_may_overflow;
178
934
            }
179
0
            return false;
180
934
        });
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
5.67k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.67k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.67k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.67k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.67k
                return false;
134
5.67k
            }
135
5.67k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5.67k
                using FromFieldType = typename FromDataType::FieldType;
137
5.67k
                using ToFieldType = typename ToDataType::FieldType;
138
5.67k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5.67k
                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
5.67k
                UInt32 to_max_digits = 0;
150
5.67k
                UInt32 to_precision = 0;
151
5.67k
                UInt32 to_scale = 0;
152
153
5.67k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
5.67k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
5.67k
                    const auto* to_decimal_type =
157
5.67k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
5.67k
                    to_precision = to_decimal_type->get_precision();
159
5.67k
                    ToDataType::check_type_precision(to_precision);
160
161
5.67k
                    to_scale = to_decimal_type->get_scale();
162
5.67k
                    ToDataType::check_type_scale(to_scale);
163
5.67k
                }
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
5.67k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5.67k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5.67k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5.67k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
5.67k
                return narrow_integral || multiply_may_overflow;
178
5.67k
            }
179
0
            return false;
180
5.67k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Line
Count
Source
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_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
127
3
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3
            using Types2 = std::decay_t<decltype(types2)>;
129
3
            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
3
            return false;
180
3
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
127
26
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
26
            using Types2 = std::decay_t<decltype(types2)>;
129
26
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
26
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
26
                return false;
134
26
            }
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
26
            return false;
180
26
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Line
Count
Source
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
            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
10
            return false;
180
10
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
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_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Line
Count
Source
127
477
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
477
            using Types2 = std::decay_t<decltype(types2)>;
129
477
            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
477
            return false;
180
477
        });
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
220
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
220
            using Types2 = std::decay_t<decltype(types2)>;
129
220
            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
220
            return false;
180
220
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
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
        });
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
5.47k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.47k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.47k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.47k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.47k
                return false;
134
5.47k
            }
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
5.47k
            return false;
180
5.47k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Line
Count
Source
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_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
127
33
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
33
            using Types2 = std::decay_t<decltype(types2)>;
129
33
            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
33
            return false;
180
33
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
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
                            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
12
            return false;
180
12
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Line
Count
Source
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
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
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
                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
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
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
16
                return narrow_integral || multiply_may_overflow;
178
16
            }
179
0
            return false;
180
16
        });
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
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
                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
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
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Line
Count
Source
127
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5
            using Types2 = std::decay_t<decltype(types2)>;
129
5
            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
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5
                using FromFieldType = typename FromDataType::FieldType;
137
5
                using ToFieldType = typename ToDataType::FieldType;
138
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5
                UInt32 from_scale = 0;
140
141
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5
                    const auto* from_decimal_type =
143
5
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5
                    from_precision =
145
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5
                    from_scale = from_decimal_type->get_scale();
147
5
                }
148
149
5
                UInt32 to_max_digits = 0;
150
5
                UInt32 to_precision = 0;
151
5
                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
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
5
                return narrow_integral || multiply_may_overflow;
178
5
            }
179
0
            return false;
180
5
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Line
Count
Source
127
378
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
378
            using Types2 = std::decay_t<decltype(types2)>;
129
378
            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
378
            return false;
180
378
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Line
Count
Source
127
106
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
106
            using Types2 = std::decay_t<decltype(types2)>;
129
106
            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
106
            return false;
180
106
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
127
348
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
348
            using Types2 = std::decay_t<decltype(types2)>;
129
348
            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
348
            return false;
180
348
        });
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
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_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Line
Count
Source
127
46
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
46
            using Types2 = std::decay_t<decltype(types2)>;
129
46
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
46
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
46
                return false;
134
46
            }
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
46
            return false;
180
46
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
127
3.72k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.72k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.72k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
3.72k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
3.72k
                return false;
134
3.72k
            }
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
3.72k
            return false;
180
3.72k
        });
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_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Line
Count
Source
127
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5
            using Types2 = std::decay_t<decltype(types2)>;
129
5
            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
5
            return false;
180
5
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
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
25
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
25
                return false;
134
25
            }
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
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Line
Count
Source
127
28
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
28
            using Types2 = std::decay_t<decltype(types2)>;
129
28
            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
28
            return false;
180
28
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Line
Count
Source
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_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Line
Count
Source
127
33
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
33
            using Types2 = std::decay_t<decltype(types2)>;
129
33
            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
33
            return false;
180
33
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
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_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Line
Count
Source
127
3
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3
            using Types2 = std::decay_t<decltype(types2)>;
129
3
            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
3
            return false;
180
3
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Line
Count
Source
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_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
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
            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
18
            return false;
180
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Line
Count
Source
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_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
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Line
Count
Source
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
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Line
Count
Source
127
11
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
11
            using Types2 = std::decay_t<decltype(types2)>;
129
11
            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
11
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
11
                using FromFieldType = typename FromDataType::FieldType;
137
11
                using ToFieldType = typename ToDataType::FieldType;
138
11
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
11
                UInt32 from_scale = 0;
140
141
11
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
11
                    const auto* from_decimal_type =
143
11
                            check_and_get_data_type<FromDataType>(from_type.get());
144
11
                    from_precision =
145
11
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
11
                    from_scale = from_decimal_type->get_scale();
147
11
                }
148
149
11
                UInt32 to_max_digits = 0;
150
11
                UInt32 to_precision = 0;
151
11
                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
11
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
11
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
11
                    to_precision = to_max_digits;
167
11
                }
168
169
11
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
11
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
11
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
11
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
11
                return narrow_integral || multiply_may_overflow;
178
11
            }
179
0
            return false;
180
11
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Line
Count
Source
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_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Line
Count
Source
127
19
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
19
            using Types2 = std::decay_t<decltype(types2)>;
129
19
            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
19
            return false;
180
19
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
127
299
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
299
            using Types2 = std::decay_t<decltype(types2)>;
129
299
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
299
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
299
                return false;
134
299
            }
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
299
            return false;
180
299
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
181
211k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
117
2.41k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
2.41k
        using Types = std::decay_t<decltype(types)>;
119
2.41k
        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.41k
        return call_on_index_and_data_type<
127
2.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.41k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.41k
            using FromDataType = typename Types2::LeftType;
130
2.41k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
2.41k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.41k
                return false;
134
2.41k
            }
135
2.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2.41k
                using FromFieldType = typename FromDataType::FieldType;
137
2.41k
                using ToFieldType = typename ToDataType::FieldType;
138
2.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2.41k
                UInt32 from_scale = 0;
140
141
2.41k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2.41k
                    const auto* from_decimal_type =
143
2.41k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2.41k
                    from_precision =
145
2.41k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2.41k
                    from_scale = from_decimal_type->get_scale();
147
2.41k
                }
148
149
2.41k
                UInt32 to_max_digits = 0;
150
2.41k
                UInt32 to_precision = 0;
151
2.41k
                UInt32 to_scale = 0;
152
153
2.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
2.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
2.41k
                    const auto* to_decimal_type =
157
2.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
2.41k
                    to_precision = to_decimal_type->get_precision();
159
2.41k
                    ToDataType::check_type_precision(to_precision);
160
161
2.41k
                    to_scale = to_decimal_type->get_scale();
162
2.41k
                    ToDataType::check_type_scale(to_scale);
163
2.41k
                }
164
2.41k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
2.41k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
2.41k
                    to_precision = to_max_digits;
167
2.41k
                }
168
169
2.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2.41k
                if (to_scale > from_scale) {
174
2.41k
                    multiply_may_overflow &=
175
2.41k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
2.41k
                }
177
2.41k
                return narrow_integral || multiply_may_overflow;
178
2.41k
            }
179
2.41k
            return false;
180
2.41k
        });
181
2.41k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
117
3.97k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
3.97k
        using Types = std::decay_t<decltype(types)>;
119
3.97k
        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.97k
        return call_on_index_and_data_type<
127
3.97k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.97k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.97k
            using FromDataType = typename Types2::LeftType;
130
3.97k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
3.97k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
3.97k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
3.97k
                return false;
134
3.97k
            }
135
3.97k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
3.97k
                using FromFieldType = typename FromDataType::FieldType;
137
3.97k
                using ToFieldType = typename ToDataType::FieldType;
138
3.97k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
3.97k
                UInt32 from_scale = 0;
140
141
3.97k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
3.97k
                    const auto* from_decimal_type =
143
3.97k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
3.97k
                    from_precision =
145
3.97k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
3.97k
                    from_scale = from_decimal_type->get_scale();
147
3.97k
                }
148
149
3.97k
                UInt32 to_max_digits = 0;
150
3.97k
                UInt32 to_precision = 0;
151
3.97k
                UInt32 to_scale = 0;
152
153
3.97k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
3.97k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
3.97k
                    const auto* to_decimal_type =
157
3.97k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
3.97k
                    to_precision = to_decimal_type->get_precision();
159
3.97k
                    ToDataType::check_type_precision(to_precision);
160
161
3.97k
                    to_scale = to_decimal_type->get_scale();
162
3.97k
                    ToDataType::check_type_scale(to_scale);
163
3.97k
                }
164
3.97k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
3.97k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
3.97k
                    to_precision = to_max_digits;
167
3.97k
                }
168
169
3.97k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
3.97k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
3.97k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
3.97k
                if (to_scale > from_scale) {
174
3.97k
                    multiply_may_overflow &=
175
3.97k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
3.97k
                }
177
3.97k
                return narrow_integral || multiply_may_overflow;
178
3.97k
            }
179
3.97k
            return false;
180
3.97k
        });
181
3.97k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
117
5.41k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
5.41k
        using Types = std::decay_t<decltype(types)>;
119
5.41k
        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
5.41k
        return call_on_index_and_data_type<
127
5.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.41k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.41k
            using FromDataType = typename Types2::LeftType;
130
5.41k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
5.41k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.41k
                return false;
134
5.41k
            }
135
5.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5.41k
                using FromFieldType = typename FromDataType::FieldType;
137
5.41k
                using ToFieldType = typename ToDataType::FieldType;
138
5.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5.41k
                UInt32 from_scale = 0;
140
141
5.41k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5.41k
                    const auto* from_decimal_type =
143
5.41k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5.41k
                    from_precision =
145
5.41k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5.41k
                    from_scale = from_decimal_type->get_scale();
147
5.41k
                }
148
149
5.41k
                UInt32 to_max_digits = 0;
150
5.41k
                UInt32 to_precision = 0;
151
5.41k
                UInt32 to_scale = 0;
152
153
5.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
5.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
5.41k
                    const auto* to_decimal_type =
157
5.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
5.41k
                    to_precision = to_decimal_type->get_precision();
159
5.41k
                    ToDataType::check_type_precision(to_precision);
160
161
5.41k
                    to_scale = to_decimal_type->get_scale();
162
5.41k
                    ToDataType::check_type_scale(to_scale);
163
5.41k
                }
164
5.41k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
5.41k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
5.41k
                    to_precision = to_max_digits;
167
5.41k
                }
168
169
5.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5.41k
                if (to_scale > from_scale) {
174
5.41k
                    multiply_may_overflow &=
175
5.41k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
5.41k
                }
177
5.41k
                return narrow_integral || multiply_may_overflow;
178
5.41k
            }
179
5.41k
            return false;
180
5.41k
        });
181
5.41k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
117
32.2k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
32.2k
        using Types = std::decay_t<decltype(types)>;
119
32.2k
        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
32.2k
        return call_on_index_and_data_type<
127
32.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
32.2k
            using Types2 = std::decay_t<decltype(types2)>;
129
32.2k
            using FromDataType = typename Types2::LeftType;
130
32.2k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
32.2k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
32.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
32.2k
                return false;
134
32.2k
            }
135
32.2k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
32.2k
                using FromFieldType = typename FromDataType::FieldType;
137
32.2k
                using ToFieldType = typename ToDataType::FieldType;
138
32.2k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
32.2k
                UInt32 from_scale = 0;
140
141
32.2k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
32.2k
                    const auto* from_decimal_type =
143
32.2k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
32.2k
                    from_precision =
145
32.2k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
32.2k
                    from_scale = from_decimal_type->get_scale();
147
32.2k
                }
148
149
32.2k
                UInt32 to_max_digits = 0;
150
32.2k
                UInt32 to_precision = 0;
151
32.2k
                UInt32 to_scale = 0;
152
153
32.2k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
32.2k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
32.2k
                    const auto* to_decimal_type =
157
32.2k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
32.2k
                    to_precision = to_decimal_type->get_precision();
159
32.2k
                    ToDataType::check_type_precision(to_precision);
160
161
32.2k
                    to_scale = to_decimal_type->get_scale();
162
32.2k
                    ToDataType::check_type_scale(to_scale);
163
32.2k
                }
164
32.2k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
32.2k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
32.2k
                    to_precision = to_max_digits;
167
32.2k
                }
168
169
32.2k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
32.2k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
32.2k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
32.2k
                if (to_scale > from_scale) {
174
32.2k
                    multiply_may_overflow &=
175
32.2k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
32.2k
                }
177
32.2k
                return narrow_integral || multiply_may_overflow;
178
32.2k
            }
179
32.2k
            return false;
180
32.2k
        });
181
32.2k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
117
33.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
33.9k
        using Types = std::decay_t<decltype(types)>;
119
33.9k
        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
33.9k
        return call_on_index_and_data_type<
127
33.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
33.9k
            using Types2 = std::decay_t<decltype(types2)>;
129
33.9k
            using FromDataType = typename Types2::LeftType;
130
33.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
33.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
33.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
33.9k
                return false;
134
33.9k
            }
135
33.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
33.9k
                using FromFieldType = typename FromDataType::FieldType;
137
33.9k
                using ToFieldType = typename ToDataType::FieldType;
138
33.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
33.9k
                UInt32 from_scale = 0;
140
141
33.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
33.9k
                    const auto* from_decimal_type =
143
33.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
33.9k
                    from_precision =
145
33.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
33.9k
                    from_scale = from_decimal_type->get_scale();
147
33.9k
                }
148
149
33.9k
                UInt32 to_max_digits = 0;
150
33.9k
                UInt32 to_precision = 0;
151
33.9k
                UInt32 to_scale = 0;
152
153
33.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
33.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
33.9k
                    const auto* to_decimal_type =
157
33.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
33.9k
                    to_precision = to_decimal_type->get_precision();
159
33.9k
                    ToDataType::check_type_precision(to_precision);
160
161
33.9k
                    to_scale = to_decimal_type->get_scale();
162
33.9k
                    ToDataType::check_type_scale(to_scale);
163
33.9k
                }
164
33.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
33.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
33.9k
                    to_precision = to_max_digits;
167
33.9k
                }
168
169
33.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
33.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
33.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
33.9k
                if (to_scale > from_scale) {
174
33.9k
                    multiply_may_overflow &=
175
33.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
33.9k
                }
177
33.9k
                return narrow_integral || multiply_may_overflow;
178
33.9k
            }
179
33.9k
            return false;
180
33.9k
        });
181
33.9k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
117
5.41k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
5.41k
        using Types = std::decay_t<decltype(types)>;
119
5.41k
        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
5.41k
        return call_on_index_and_data_type<
127
5.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.41k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.41k
            using FromDataType = typename Types2::LeftType;
130
5.41k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
5.41k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.41k
                return false;
134
5.41k
            }
135
5.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5.41k
                using FromFieldType = typename FromDataType::FieldType;
137
5.41k
                using ToFieldType = typename ToDataType::FieldType;
138
5.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5.41k
                UInt32 from_scale = 0;
140
141
5.41k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5.41k
                    const auto* from_decimal_type =
143
5.41k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5.41k
                    from_precision =
145
5.41k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5.41k
                    from_scale = from_decimal_type->get_scale();
147
5.41k
                }
148
149
5.41k
                UInt32 to_max_digits = 0;
150
5.41k
                UInt32 to_precision = 0;
151
5.41k
                UInt32 to_scale = 0;
152
153
5.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
5.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
5.41k
                    const auto* to_decimal_type =
157
5.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
5.41k
                    to_precision = to_decimal_type->get_precision();
159
5.41k
                    ToDataType::check_type_precision(to_precision);
160
161
5.41k
                    to_scale = to_decimal_type->get_scale();
162
5.41k
                    ToDataType::check_type_scale(to_scale);
163
5.41k
                }
164
5.41k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
5.41k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
5.41k
                    to_precision = to_max_digits;
167
5.41k
                }
168
169
5.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5.41k
                if (to_scale > from_scale) {
174
5.41k
                    multiply_may_overflow &=
175
5.41k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
5.41k
                }
177
5.41k
                return narrow_integral || multiply_may_overflow;
178
5.41k
            }
179
5.41k
            return false;
180
5.41k
        });
181
5.41k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
117
10.7k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
10.7k
        using Types = std::decay_t<decltype(types)>;
119
10.7k
        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
10.7k
        return call_on_index_and_data_type<
127
10.7k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
10.7k
            using Types2 = std::decay_t<decltype(types2)>;
129
10.7k
            using FromDataType = typename Types2::LeftType;
130
10.7k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
10.7k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
10.7k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
10.7k
                return false;
134
10.7k
            }
135
10.7k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
10.7k
                using FromFieldType = typename FromDataType::FieldType;
137
10.7k
                using ToFieldType = typename ToDataType::FieldType;
138
10.7k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
10.7k
                UInt32 from_scale = 0;
140
141
10.7k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
10.7k
                    const auto* from_decimal_type =
143
10.7k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
10.7k
                    from_precision =
145
10.7k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
10.7k
                    from_scale = from_decimal_type->get_scale();
147
10.7k
                }
148
149
10.7k
                UInt32 to_max_digits = 0;
150
10.7k
                UInt32 to_precision = 0;
151
10.7k
                UInt32 to_scale = 0;
152
153
10.7k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
10.7k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
10.7k
                    const auto* to_decimal_type =
157
10.7k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
10.7k
                    to_precision = to_decimal_type->get_precision();
159
10.7k
                    ToDataType::check_type_precision(to_precision);
160
161
10.7k
                    to_scale = to_decimal_type->get_scale();
162
10.7k
                    ToDataType::check_type_scale(to_scale);
163
10.7k
                }
164
10.7k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
10.7k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
10.7k
                    to_precision = to_max_digits;
167
10.7k
                }
168
169
10.7k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
10.7k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
10.7k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
10.7k
                if (to_scale > from_scale) {
174
10.7k
                    multiply_may_overflow &=
175
10.7k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
10.7k
                }
177
10.7k
                return narrow_integral || multiply_may_overflow;
178
10.7k
            }
179
10.7k
            return false;
180
10.7k
        });
181
10.7k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
117
24.5k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
24.5k
        using Types = std::decay_t<decltype(types)>;
119
24.5k
        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
24.5k
        return call_on_index_and_data_type<
127
24.5k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
24.5k
            using Types2 = std::decay_t<decltype(types2)>;
129
24.5k
            using FromDataType = typename Types2::LeftType;
130
24.5k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
24.5k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
24.5k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
24.5k
                return false;
134
24.5k
            }
135
24.5k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
24.5k
                using FromFieldType = typename FromDataType::FieldType;
137
24.5k
                using ToFieldType = typename ToDataType::FieldType;
138
24.5k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
24.5k
                UInt32 from_scale = 0;
140
141
24.5k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
24.5k
                    const auto* from_decimal_type =
143
24.5k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
24.5k
                    from_precision =
145
24.5k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
24.5k
                    from_scale = from_decimal_type->get_scale();
147
24.5k
                }
148
149
24.5k
                UInt32 to_max_digits = 0;
150
24.5k
                UInt32 to_precision = 0;
151
24.5k
                UInt32 to_scale = 0;
152
153
24.5k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
24.5k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
24.5k
                    const auto* to_decimal_type =
157
24.5k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
24.5k
                    to_precision = to_decimal_type->get_precision();
159
24.5k
                    ToDataType::check_type_precision(to_precision);
160
161
24.5k
                    to_scale = to_decimal_type->get_scale();
162
24.5k
                    ToDataType::check_type_scale(to_scale);
163
24.5k
                }
164
24.5k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
24.5k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
24.5k
                    to_precision = to_max_digits;
167
24.5k
                }
168
169
24.5k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
24.5k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
24.5k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
24.5k
                if (to_scale > from_scale) {
174
24.5k
                    multiply_may_overflow &=
175
24.5k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
24.5k
                }
177
24.5k
                return narrow_integral || multiply_may_overflow;
178
24.5k
            }
179
24.5k
            return false;
180
24.5k
        });
181
24.5k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
117
7.71k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
7.71k
        using Types = std::decay_t<decltype(types)>;
119
7.71k
        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
7.71k
        return call_on_index_and_data_type<
127
7.71k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.71k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.71k
            using FromDataType = typename Types2::LeftType;
130
7.71k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
7.71k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
7.71k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
7.71k
                return false;
134
7.71k
            }
135
7.71k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7.71k
                using FromFieldType = typename FromDataType::FieldType;
137
7.71k
                using ToFieldType = typename ToDataType::FieldType;
138
7.71k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7.71k
                UInt32 from_scale = 0;
140
141
7.71k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
7.71k
                    const auto* from_decimal_type =
143
7.71k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
7.71k
                    from_precision =
145
7.71k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
7.71k
                    from_scale = from_decimal_type->get_scale();
147
7.71k
                }
148
149
7.71k
                UInt32 to_max_digits = 0;
150
7.71k
                UInt32 to_precision = 0;
151
7.71k
                UInt32 to_scale = 0;
152
153
7.71k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7.71k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7.71k
                    const auto* to_decimal_type =
157
7.71k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7.71k
                    to_precision = to_decimal_type->get_precision();
159
7.71k
                    ToDataType::check_type_precision(to_precision);
160
161
7.71k
                    to_scale = to_decimal_type->get_scale();
162
7.71k
                    ToDataType::check_type_scale(to_scale);
163
7.71k
                }
164
7.71k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
7.71k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
7.71k
                    to_precision = to_max_digits;
167
7.71k
                }
168
169
7.71k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7.71k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7.71k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7.71k
                if (to_scale > from_scale) {
174
7.71k
                    multiply_may_overflow &=
175
7.71k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
7.71k
                }
177
7.71k
                return narrow_integral || multiply_may_overflow;
178
7.71k
            }
179
7.71k
            return false;
180
7.71k
        });
181
7.71k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
117
11.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
11.9k
        using Types = std::decay_t<decltype(types)>;
119
11.9k
        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
11.9k
        return call_on_index_and_data_type<
127
11.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
11.9k
            using Types2 = std::decay_t<decltype(types2)>;
129
11.9k
            using FromDataType = typename Types2::LeftType;
130
11.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
11.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
11.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
11.9k
                return false;
134
11.9k
            }
135
11.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
11.9k
                using FromFieldType = typename FromDataType::FieldType;
137
11.9k
                using ToFieldType = typename ToDataType::FieldType;
138
11.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
11.9k
                UInt32 from_scale = 0;
140
141
11.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
11.9k
                    const auto* from_decimal_type =
143
11.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
11.9k
                    from_precision =
145
11.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
11.9k
                    from_scale = from_decimal_type->get_scale();
147
11.9k
                }
148
149
11.9k
                UInt32 to_max_digits = 0;
150
11.9k
                UInt32 to_precision = 0;
151
11.9k
                UInt32 to_scale = 0;
152
153
11.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
11.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
11.9k
                    const auto* to_decimal_type =
157
11.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
11.9k
                    to_precision = to_decimal_type->get_precision();
159
11.9k
                    ToDataType::check_type_precision(to_precision);
160
161
11.9k
                    to_scale = to_decimal_type->get_scale();
162
11.9k
                    ToDataType::check_type_scale(to_scale);
163
11.9k
                }
164
11.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
11.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
11.9k
                    to_precision = to_max_digits;
167
11.9k
                }
168
169
11.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
11.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
11.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
11.9k
                if (to_scale > from_scale) {
174
11.9k
                    multiply_may_overflow &=
175
11.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
11.9k
                }
177
11.9k
                return narrow_integral || multiply_may_overflow;
178
11.9k
            }
179
11.9k
            return false;
180
11.9k
        });
181
11.9k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
117
228
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
228
        using Types = std::decay_t<decltype(types)>;
119
228
        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
228
        return call_on_index_and_data_type<
127
228
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
228
            using Types2 = std::decay_t<decltype(types2)>;
129
228
            using FromDataType = typename Types2::LeftType;
130
228
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
228
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
228
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
228
                return false;
134
228
            }
135
228
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
228
                using FromFieldType = typename FromDataType::FieldType;
137
228
                using ToFieldType = typename ToDataType::FieldType;
138
228
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
228
                UInt32 from_scale = 0;
140
141
228
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
228
                    const auto* from_decimal_type =
143
228
                            check_and_get_data_type<FromDataType>(from_type.get());
144
228
                    from_precision =
145
228
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
228
                    from_scale = from_decimal_type->get_scale();
147
228
                }
148
149
228
                UInt32 to_max_digits = 0;
150
228
                UInt32 to_precision = 0;
151
228
                UInt32 to_scale = 0;
152
153
228
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
228
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
228
                    const auto* to_decimal_type =
157
228
                            check_and_get_data_type<ToDataType>(to_type.get());
158
228
                    to_precision = to_decimal_type->get_precision();
159
228
                    ToDataType::check_type_precision(to_precision);
160
161
228
                    to_scale = to_decimal_type->get_scale();
162
228
                    ToDataType::check_type_scale(to_scale);
163
228
                }
164
228
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
228
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
228
                    to_precision = to_max_digits;
167
228
                }
168
169
228
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
228
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
228
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
228
                if (to_scale > from_scale) {
174
228
                    multiply_may_overflow &=
175
228
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
228
                }
177
228
                return narrow_integral || multiply_may_overflow;
178
228
            }
179
228
            return false;
180
228
        });
181
228
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
117
13.3k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
13.3k
        using Types = std::decay_t<decltype(types)>;
119
13.3k
        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
13.3k
        return call_on_index_and_data_type<
127
13.3k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
13.3k
            using Types2 = std::decay_t<decltype(types2)>;
129
13.3k
            using FromDataType = typename Types2::LeftType;
130
13.3k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
13.3k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
13.3k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
13.3k
                return false;
134
13.3k
            }
135
13.3k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
13.3k
                using FromFieldType = typename FromDataType::FieldType;
137
13.3k
                using ToFieldType = typename ToDataType::FieldType;
138
13.3k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
13.3k
                UInt32 from_scale = 0;
140
141
13.3k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
13.3k
                    const auto* from_decimal_type =
143
13.3k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
13.3k
                    from_precision =
145
13.3k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
13.3k
                    from_scale = from_decimal_type->get_scale();
147
13.3k
                }
148
149
13.3k
                UInt32 to_max_digits = 0;
150
13.3k
                UInt32 to_precision = 0;
151
13.3k
                UInt32 to_scale = 0;
152
153
13.3k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
13.3k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
13.3k
                    const auto* to_decimal_type =
157
13.3k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
13.3k
                    to_precision = to_decimal_type->get_precision();
159
13.3k
                    ToDataType::check_type_precision(to_precision);
160
161
13.3k
                    to_scale = to_decimal_type->get_scale();
162
13.3k
                    ToDataType::check_type_scale(to_scale);
163
13.3k
                }
164
13.3k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
13.3k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
13.3k
                    to_precision = to_max_digits;
167
13.3k
                }
168
169
13.3k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
13.3k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
13.3k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
13.3k
                if (to_scale > from_scale) {
174
13.3k
                    multiply_may_overflow &=
175
13.3k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
13.3k
                }
177
13.3k
                return narrow_integral || multiply_may_overflow;
178
13.3k
            }
179
13.3k
            return false;
180
13.3k
        });
181
13.3k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_
Line
Count
Source
117
10.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
10.9k
        using Types = std::decay_t<decltype(types)>;
119
10.9k
        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
10.9k
        return call_on_index_and_data_type<
127
10.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
10.9k
            using Types2 = std::decay_t<decltype(types2)>;
129
10.9k
            using FromDataType = typename Types2::LeftType;
130
10.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
10.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
10.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
10.9k
                return false;
134
10.9k
            }
135
10.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
10.9k
                using FromFieldType = typename FromDataType::FieldType;
137
10.9k
                using ToFieldType = typename ToDataType::FieldType;
138
10.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
10.9k
                UInt32 from_scale = 0;
140
141
10.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
10.9k
                    const auto* from_decimal_type =
143
10.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
10.9k
                    from_precision =
145
10.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
10.9k
                    from_scale = from_decimal_type->get_scale();
147
10.9k
                }
148
149
10.9k
                UInt32 to_max_digits = 0;
150
10.9k
                UInt32 to_precision = 0;
151
10.9k
                UInt32 to_scale = 0;
152
153
10.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
10.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
10.9k
                    const auto* to_decimal_type =
157
10.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
10.9k
                    to_precision = to_decimal_type->get_precision();
159
10.9k
                    ToDataType::check_type_precision(to_precision);
160
161
10.9k
                    to_scale = to_decimal_type->get_scale();
162
10.9k
                    ToDataType::check_type_scale(to_scale);
163
10.9k
                }
164
10.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
10.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
10.9k
                    to_precision = to_max_digits;
167
10.9k
                }
168
169
10.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
10.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
10.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
10.9k
                if (to_scale > from_scale) {
174
10.9k
                    multiply_may_overflow &=
175
10.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
10.9k
                }
177
10.9k
                return narrow_integral || multiply_may_overflow;
178
10.9k
            }
179
10.9k
            return false;
180
10.9k
        });
181
10.9k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_
Line
Count
Source
117
30
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
30
        using Types = std::decay_t<decltype(types)>;
119
30
        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
30
        return call_on_index_and_data_type<
127
30
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
30
            using Types2 = std::decay_t<decltype(types2)>;
129
30
            using FromDataType = typename Types2::LeftType;
130
30
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
30
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
30
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
30
                return false;
134
30
            }
135
30
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
30
                using FromFieldType = typename FromDataType::FieldType;
137
30
                using ToFieldType = typename ToDataType::FieldType;
138
30
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
30
                UInt32 from_scale = 0;
140
141
30
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
30
                    const auto* from_decimal_type =
143
30
                            check_and_get_data_type<FromDataType>(from_type.get());
144
30
                    from_precision =
145
30
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
30
                    from_scale = from_decimal_type->get_scale();
147
30
                }
148
149
30
                UInt32 to_max_digits = 0;
150
30
                UInt32 to_precision = 0;
151
30
                UInt32 to_scale = 0;
152
153
30
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
30
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
30
                    const auto* to_decimal_type =
157
30
                            check_and_get_data_type<ToDataType>(to_type.get());
158
30
                    to_precision = to_decimal_type->get_precision();
159
30
                    ToDataType::check_type_precision(to_precision);
160
161
30
                    to_scale = to_decimal_type->get_scale();
162
30
                    ToDataType::check_type_scale(to_scale);
163
30
                }
164
30
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
30
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
30
                    to_precision = to_max_digits;
167
30
                }
168
169
30
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
30
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
30
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
30
                if (to_scale > from_scale) {
174
30
                    multiply_may_overflow &=
175
30
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
30
                }
177
30
                return narrow_integral || multiply_may_overflow;
178
30
            }
179
30
            return false;
180
30
        });
181
30
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_
Line
Count
Source
117
7.45k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
7.45k
        using Types = std::decay_t<decltype(types)>;
119
7.45k
        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
7.45k
        return call_on_index_and_data_type<
127
7.45k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.45k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.45k
            using FromDataType = typename Types2::LeftType;
130
7.45k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
7.45k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
7.45k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
7.45k
                return false;
134
7.45k
            }
135
7.45k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7.45k
                using FromFieldType = typename FromDataType::FieldType;
137
7.45k
                using ToFieldType = typename ToDataType::FieldType;
138
7.45k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7.45k
                UInt32 from_scale = 0;
140
141
7.45k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
7.45k
                    const auto* from_decimal_type =
143
7.45k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
7.45k
                    from_precision =
145
7.45k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
7.45k
                    from_scale = from_decimal_type->get_scale();
147
7.45k
                }
148
149
7.45k
                UInt32 to_max_digits = 0;
150
7.45k
                UInt32 to_precision = 0;
151
7.45k
                UInt32 to_scale = 0;
152
153
7.45k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7.45k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7.45k
                    const auto* to_decimal_type =
157
7.45k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7.45k
                    to_precision = to_decimal_type->get_precision();
159
7.45k
                    ToDataType::check_type_precision(to_precision);
160
161
7.45k
                    to_scale = to_decimal_type->get_scale();
162
7.45k
                    ToDataType::check_type_scale(to_scale);
163
7.45k
                }
164
7.45k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
7.45k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
7.45k
                    to_precision = to_max_digits;
167
7.45k
                }
168
169
7.45k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7.45k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7.45k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7.45k
                if (to_scale > from_scale) {
174
7.45k
                    multiply_may_overflow &=
175
7.45k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
7.45k
                }
177
7.45k
                return narrow_integral || multiply_may_overflow;
178
7.45k
            }
179
7.45k
            return false;
180
7.45k
        });
181
7.45k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
117
4.81k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
4.81k
        using Types = std::decay_t<decltype(types)>;
119
4.81k
        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.81k
        return call_on_index_and_data_type<
127
4.81k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4.81k
            using Types2 = std::decay_t<decltype(types2)>;
129
4.81k
            using FromDataType = typename Types2::LeftType;
130
4.81k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
4.81k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
4.81k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
4.81k
                return false;
134
4.81k
            }
135
4.81k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
4.81k
                using FromFieldType = typename FromDataType::FieldType;
137
4.81k
                using ToFieldType = typename ToDataType::FieldType;
138
4.81k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
4.81k
                UInt32 from_scale = 0;
140
141
4.81k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
4.81k
                    const auto* from_decimal_type =
143
4.81k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
4.81k
                    from_precision =
145
4.81k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
4.81k
                    from_scale = from_decimal_type->get_scale();
147
4.81k
                }
148
149
4.81k
                UInt32 to_max_digits = 0;
150
4.81k
                UInt32 to_precision = 0;
151
4.81k
                UInt32 to_scale = 0;
152
153
4.81k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
4.81k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
4.81k
                    const auto* to_decimal_type =
157
4.81k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
4.81k
                    to_precision = to_decimal_type->get_precision();
159
4.81k
                    ToDataType::check_type_precision(to_precision);
160
161
4.81k
                    to_scale = to_decimal_type->get_scale();
162
4.81k
                    ToDataType::check_type_scale(to_scale);
163
4.81k
                }
164
4.81k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
4.81k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
4.81k
                    to_precision = to_max_digits;
167
4.81k
                }
168
169
4.81k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
4.81k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
4.81k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
4.81k
                if (to_scale > from_scale) {
174
4.81k
                    multiply_may_overflow &=
175
4.81k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
4.81k
                }
177
4.81k
                return narrow_integral || multiply_may_overflow;
178
4.81k
            }
179
4.81k
            return false;
180
4.81k
        });
181
4.81k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_
Line
Count
Source
117
30
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
30
        using Types = std::decay_t<decltype(types)>;
119
30
        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
30
        return call_on_index_and_data_type<
127
30
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
30
            using Types2 = std::decay_t<decltype(types2)>;
129
30
            using FromDataType = typename Types2::LeftType;
130
30
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
30
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
30
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
30
                return false;
134
30
            }
135
30
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
30
                using FromFieldType = typename FromDataType::FieldType;
137
30
                using ToFieldType = typename ToDataType::FieldType;
138
30
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
30
                UInt32 from_scale = 0;
140
141
30
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
30
                    const auto* from_decimal_type =
143
30
                            check_and_get_data_type<FromDataType>(from_type.get());
144
30
                    from_precision =
145
30
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
30
                    from_scale = from_decimal_type->get_scale();
147
30
                }
148
149
30
                UInt32 to_max_digits = 0;
150
30
                UInt32 to_precision = 0;
151
30
                UInt32 to_scale = 0;
152
153
30
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
30
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
30
                    const auto* to_decimal_type =
157
30
                            check_and_get_data_type<ToDataType>(to_type.get());
158
30
                    to_precision = to_decimal_type->get_precision();
159
30
                    ToDataType::check_type_precision(to_precision);
160
161
30
                    to_scale = to_decimal_type->get_scale();
162
30
                    ToDataType::check_type_scale(to_scale);
163
30
                }
164
30
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
30
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
30
                    to_precision = to_max_digits;
167
30
                }
168
169
30
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
30
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
30
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
30
                if (to_scale > from_scale) {
174
30
                    multiply_may_overflow &=
175
30
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
30
                }
177
30
                return narrow_integral || multiply_may_overflow;
178
30
            }
179
30
            return false;
180
30
        });
181
30
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_
Line
Count
Source
117
459
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
459
        using Types = std::decay_t<decltype(types)>;
119
459
        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
459
        return call_on_index_and_data_type<
127
459
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
459
            using Types2 = std::decay_t<decltype(types2)>;
129
459
            using FromDataType = typename Types2::LeftType;
130
459
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
459
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
459
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
459
                return false;
134
459
            }
135
459
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
459
                using FromFieldType = typename FromDataType::FieldType;
137
459
                using ToFieldType = typename ToDataType::FieldType;
138
459
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
459
                UInt32 from_scale = 0;
140
141
459
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
459
                    const auto* from_decimal_type =
143
459
                            check_and_get_data_type<FromDataType>(from_type.get());
144
459
                    from_precision =
145
459
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
459
                    from_scale = from_decimal_type->get_scale();
147
459
                }
148
149
459
                UInt32 to_max_digits = 0;
150
459
                UInt32 to_precision = 0;
151
459
                UInt32 to_scale = 0;
152
153
459
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
459
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
459
                    const auto* to_decimal_type =
157
459
                            check_and_get_data_type<ToDataType>(to_type.get());
158
459
                    to_precision = to_decimal_type->get_precision();
159
459
                    ToDataType::check_type_precision(to_precision);
160
161
459
                    to_scale = to_decimal_type->get_scale();
162
459
                    ToDataType::check_type_scale(to_scale);
163
459
                }
164
459
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
459
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
459
                    to_precision = to_max_digits;
167
459
                }
168
169
459
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
459
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
459
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
459
                if (to_scale > from_scale) {
174
459
                    multiply_may_overflow &=
175
459
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
459
                }
177
459
                return narrow_integral || multiply_may_overflow;
178
459
            }
179
459
            return false;
180
459
        });
181
459
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_
Line
Count
Source
117
462
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
462
        using Types = std::decay_t<decltype(types)>;
119
462
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
462
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
462
            return false;
125
462
        }
126
0
        return call_on_index_and_data_type<
127
462
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
462
            using Types2 = std::decay_t<decltype(types2)>;
129
462
            using FromDataType = typename Types2::LeftType;
130
462
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
462
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
462
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
462
                return false;
134
462
            }
135
462
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
462
                using FromFieldType = typename FromDataType::FieldType;
137
462
                using ToFieldType = typename ToDataType::FieldType;
138
462
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
462
                UInt32 from_scale = 0;
140
141
462
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
462
                    const auto* from_decimal_type =
143
462
                            check_and_get_data_type<FromDataType>(from_type.get());
144
462
                    from_precision =
145
462
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
462
                    from_scale = from_decimal_type->get_scale();
147
462
                }
148
149
462
                UInt32 to_max_digits = 0;
150
462
                UInt32 to_precision = 0;
151
462
                UInt32 to_scale = 0;
152
153
462
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
462
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
462
                    const auto* to_decimal_type =
157
462
                            check_and_get_data_type<ToDataType>(to_type.get());
158
462
                    to_precision = to_decimal_type->get_precision();
159
462
                    ToDataType::check_type_precision(to_precision);
160
161
462
                    to_scale = to_decimal_type->get_scale();
162
462
                    ToDataType::check_type_scale(to_scale);
163
462
                }
164
462
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
462
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
462
                    to_precision = to_max_digits;
167
462
                }
168
169
462
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
462
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
462
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
462
                if (to_scale > from_scale) {
174
462
                    multiply_may_overflow &=
175
462
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
462
                }
177
462
                return narrow_integral || multiply_may_overflow;
178
462
            }
179
462
            return false;
180
462
        });
181
462
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_
Line
Count
Source
117
636
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
636
        using Types = std::decay_t<decltype(types)>;
119
636
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
636
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
636
            return false;
125
636
        }
126
0
        return call_on_index_and_data_type<
127
636
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
636
            using Types2 = std::decay_t<decltype(types2)>;
129
636
            using FromDataType = typename Types2::LeftType;
130
636
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
636
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
636
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
636
                return false;
134
636
            }
135
636
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
636
                using FromFieldType = typename FromDataType::FieldType;
137
636
                using ToFieldType = typename ToDataType::FieldType;
138
636
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
636
                UInt32 from_scale = 0;
140
141
636
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
636
                    const auto* from_decimal_type =
143
636
                            check_and_get_data_type<FromDataType>(from_type.get());
144
636
                    from_precision =
145
636
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
636
                    from_scale = from_decimal_type->get_scale();
147
636
                }
148
149
636
                UInt32 to_max_digits = 0;
150
636
                UInt32 to_precision = 0;
151
636
                UInt32 to_scale = 0;
152
153
636
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
636
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
636
                    const auto* to_decimal_type =
157
636
                            check_and_get_data_type<ToDataType>(to_type.get());
158
636
                    to_precision = to_decimal_type->get_precision();
159
636
                    ToDataType::check_type_precision(to_precision);
160
161
636
                    to_scale = to_decimal_type->get_scale();
162
636
                    ToDataType::check_type_scale(to_scale);
163
636
                }
164
636
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
636
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
636
                    to_precision = to_max_digits;
167
636
                }
168
169
636
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
636
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
636
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
636
                if (to_scale > from_scale) {
174
636
                    multiply_may_overflow &=
175
636
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
636
                }
177
636
                return narrow_integral || multiply_may_overflow;
178
636
            }
179
636
            return false;
180
636
        });
181
636
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_
Line
Count
Source
117
292
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
292
        using Types = std::decay_t<decltype(types)>;
119
292
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
292
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
292
            return false;
125
292
        }
126
0
        return call_on_index_and_data_type<
127
292
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
292
            using Types2 = std::decay_t<decltype(types2)>;
129
292
            using FromDataType = typename Types2::LeftType;
130
292
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
292
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
292
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
292
                return false;
134
292
            }
135
292
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
292
                using FromFieldType = typename FromDataType::FieldType;
137
292
                using ToFieldType = typename ToDataType::FieldType;
138
292
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
292
                UInt32 from_scale = 0;
140
141
292
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
292
                    const auto* from_decimal_type =
143
292
                            check_and_get_data_type<FromDataType>(from_type.get());
144
292
                    from_precision =
145
292
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
292
                    from_scale = from_decimal_type->get_scale();
147
292
                }
148
149
292
                UInt32 to_max_digits = 0;
150
292
                UInt32 to_precision = 0;
151
292
                UInt32 to_scale = 0;
152
153
292
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
292
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
292
                    const auto* to_decimal_type =
157
292
                            check_and_get_data_type<ToDataType>(to_type.get());
158
292
                    to_precision = to_decimal_type->get_precision();
159
292
                    ToDataType::check_type_precision(to_precision);
160
161
292
                    to_scale = to_decimal_type->get_scale();
162
292
                    ToDataType::check_type_scale(to_scale);
163
292
                }
164
292
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
292
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
292
                    to_precision = to_max_digits;
167
292
                }
168
169
292
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
292
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
292
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
292
                if (to_scale > from_scale) {
174
292
                    multiply_may_overflow &=
175
292
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
292
                }
177
292
                return narrow_integral || multiply_may_overflow;
178
292
            }
179
292
            return false;
180
292
        });
181
292
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_
Line
Count
Source
117
34.2k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
34.2k
        using Types = std::decay_t<decltype(types)>;
119
34.2k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
34.2k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
34.2k
            return false;
125
34.2k
        }
126
0
        return call_on_index_and_data_type<
127
34.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
34.2k
            using Types2 = std::decay_t<decltype(types2)>;
129
34.2k
            using FromDataType = typename Types2::LeftType;
130
34.2k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
34.2k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
34.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
34.2k
                return false;
134
34.2k
            }
135
34.2k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
34.2k
                using FromFieldType = typename FromDataType::FieldType;
137
34.2k
                using ToFieldType = typename ToDataType::FieldType;
138
34.2k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
34.2k
                UInt32 from_scale = 0;
140
141
34.2k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
34.2k
                    const auto* from_decimal_type =
143
34.2k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
34.2k
                    from_precision =
145
34.2k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
34.2k
                    from_scale = from_decimal_type->get_scale();
147
34.2k
                }
148
149
34.2k
                UInt32 to_max_digits = 0;
150
34.2k
                UInt32 to_precision = 0;
151
34.2k
                UInt32 to_scale = 0;
152
153
34.2k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
34.2k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
34.2k
                    const auto* to_decimal_type =
157
34.2k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
34.2k
                    to_precision = to_decimal_type->get_precision();
159
34.2k
                    ToDataType::check_type_precision(to_precision);
160
161
34.2k
                    to_scale = to_decimal_type->get_scale();
162
34.2k
                    ToDataType::check_type_scale(to_scale);
163
34.2k
                }
164
34.2k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
34.2k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
34.2k
                    to_precision = to_max_digits;
167
34.2k
                }
168
169
34.2k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
34.2k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
34.2k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
34.2k
                if (to_scale > from_scale) {
174
34.2k
                    multiply_may_overflow &=
175
34.2k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
34.2k
                }
177
34.2k
                return narrow_integral || multiply_may_overflow;
178
34.2k
            }
179
34.2k
            return false;
180
34.2k
        });
181
34.2k
    };
182
183
298k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
184
362k
}
185
186
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
187
386k
                                    const DataTypePtr& to_type) {
188
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
189
386k
    bool result_is_nullable = to_type->is_nullable();
190
191
386k
    if (result_is_nullable) {
192
361k
        return [from_type, to_type](FunctionContext* context, Block& block,
193
361k
                                    const ColumnNumbers& arguments, uint32_t result,
194
361k
                                    size_t input_rows_count,
195
362k
                                    const NullMap::value_type* null_map = nullptr) {
196
362k
            auto from_type_not_nullable = remove_nullable(from_type);
197
362k
            auto to_type_not_nullable = remove_nullable(to_type);
198
199
362k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
200
362k
                    context, from_type_not_nullable, to_type_not_nullable);
201
202
362k
            auto nested_result_index = block.columns();
203
362k
            block.insert(block.get_by_position(result).unnest_nullable());
204
362k
            auto nested_source_index = block.columns();
205
362k
            block.insert(block.get_by_position(arguments[0])
206
362k
                                 .unnest_nullable(replace_null_data_to_default));
207
208
362k
            const auto& arg_col = block.get_by_position(arguments[0]);
209
362k
            const NullMap::value_type* arg_null_map = nullptr;
210
362k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
211
308k
                arg_null_map = nullable->get_null_map_data().data();
212
308k
            }
213
362k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
214
362k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
215
362k
                    arg_null_map));
216
217
336k
            block.get_by_position(result).column =
218
336k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
219
336k
                                     arguments, input_rows_count);
220
221
336k
            block.erase(nested_source_index);
222
336k
            block.erase(nested_result_index);
223
336k
            return Status::OK();
224
362k
        };
225
361k
    } else {
226
24.7k
        return prepare_impl(context, from_type, to_type);
227
24.7k
    }
228
386k
}
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
402k
                         const DataTypePtr& origin_to_type) {
234
402k
    auto to_type = get_serialized_type(origin_to_type);
235
402k
    auto from_type = get_serialized_type(origin_from_type);
236
402k
    if (from_type->equals(*to_type)) {
237
69.7k
        return create_identity_wrapper(from_type);
238
69.7k
    }
239
240
    // variant needs to be judged first
241
332k
    if (to_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
242
11.7k
        return create_cast_to_variant_wrapper(from_type,
243
11.7k
                                              static_cast<const DataTypeVariant&>(*to_type));
244
11.7k
    }
245
321k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
246
18.2k
        return create_cast_from_variant_wrapper(static_cast<const DataTypeVariant&>(*from_type),
247
18.2k
                                                to_type);
248
18.2k
    }
249
250
302k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
251
9.27k
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
252
9.27k
                                              to_type,
253
9.27k
                                              context ? context->jsonb_string_as_string() : false);
254
9.27k
    }
255
256
293k
    switch (to_type->get_primitive_type()) {
257
1.02k
    case PrimitiveType::TYPE_BOOLEAN:
258
1.02k
        return create_boolean_wrapper(context, from_type);
259
4.07k
    case PrimitiveType::TYPE_TINYINT:
260
4.07k
        return create_int_wrapper<DataTypeInt8>(context, from_type);
261
5.38k
    case PrimitiveType::TYPE_SMALLINT:
262
5.38k
        return create_int_wrapper<DataTypeInt16>(context, from_type);
263
30.1k
    case PrimitiveType::TYPE_INT:
264
30.1k
        return create_int_wrapper<DataTypeInt32>(context, from_type);
265
39.6k
    case PrimitiveType::TYPE_BIGINT:
266
39.6k
        return create_int_wrapper<DataTypeInt64>(context, from_type);
267
4.84k
    case PrimitiveType::TYPE_LARGEINT:
268
4.84k
        return create_int_wrapper<DataTypeInt128>(context, from_type);
269
10.9k
    case PrimitiveType::TYPE_FLOAT:
270
10.9k
        return create_float_wrapper<DataTypeFloat32>(context, from_type);
271
27.8k
    case PrimitiveType::TYPE_DOUBLE:
272
27.8k
        return create_float_wrapper<DataTypeFloat64>(context, from_type);
273
30
    case PrimitiveType::TYPE_DATE:
274
30
        return create_datelike_wrapper<DataTypeDate>(context, from_type);
275
30
    case PrimitiveType::TYPE_DATETIME:
276
30
        return create_datelike_wrapper<DataTypeDateTime>(context, from_type);
277
7.41k
    case PrimitiveType::TYPE_DATEV2:
278
7.41k
        return create_datelike_wrapper<DataTypeDateV2>(context, from_type);
279
5.19k
    case PrimitiveType::TYPE_DATETIMEV2:
280
5.19k
        return create_datelike_wrapper<DataTypeDateTimeV2>(context, from_type);
281
462
    case PrimitiveType::TYPE_TIMESTAMPTZ:
282
462
        return create_timestamptz_wrapper(context, from_type);
283
460
    case PrimitiveType::TYPE_TIMEV2:
284
460
        return create_datelike_wrapper<DataTypeTimeV2>(context, from_type);
285
481
    case PrimitiveType::TYPE_IPV4:
286
481
        return create_ip_wrapper<DataTypeIPv4>(context, from_type);
287
290
    case PrimitiveType::TYPE_IPV6:
288
290
        return create_ip_wrapper<DataTypeIPv6>(context, from_type);
289
291
    case PrimitiveType::TYPE_DECIMALV2:
290
291
        return create_decimal_wrapper<DataTypeDecimalV2>(context, from_type);
291
7.80k
    case PrimitiveType::TYPE_DECIMAL32:
292
7.80k
        return create_decimal_wrapper<DataTypeDecimal32>(context, from_type);
293
14.6k
    case PrimitiveType::TYPE_DECIMAL64:
294
14.6k
        return create_decimal_wrapper<DataTypeDecimal64>(context, from_type);
295
15.6k
    case PrimitiveType::TYPE_DECIMAL128I:
296
15.6k
        return create_decimal_wrapper<DataTypeDecimal128>(context, from_type);
297
11.0k
    case PrimitiveType::TYPE_DECIMAL256:
298
11.0k
        return create_decimal_wrapper<DataTypeDecimal256>(context, from_type);
299
33
    case PrimitiveType::TYPE_CHAR:
300
5.80k
    case PrimitiveType::TYPE_VARCHAR:
301
30.7k
    case PrimitiveType::TYPE_STRING:
302
30.7k
        return create_string_wrapper(from_type);
303
14.1k
    case PrimitiveType::TYPE_ARRAY:
304
14.1k
        return create_array_wrapper(context, from_type,
305
14.1k
                                    static_cast<const DataTypeArray&>(*to_type));
306
1.34k
    case PrimitiveType::TYPE_STRUCT:
307
1.34k
        return create_struct_wrapper(context, from_type,
308
1.34k
                                     static_cast<const DataTypeStruct&>(*to_type));
309
956
    case PrimitiveType::TYPE_MAP:
310
956
        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
1
    case PrimitiveType::TYPE_BITMAP:
314
1
        return create_bitmap_wrapper(context, from_type,
315
1
                                     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
59.0k
    case PrimitiveType::TYPE_JSONB:
320
59.0k
        return create_cast_to_jsonb_wrapper(from_type, static_cast<const DataTypeJsonb&>(*to_type),
321
59.0k
                                            context ? context->string_as_jsonb_string() : false);
322
2
    case PrimitiveType::TYPE_VARBINARY:
323
2
        return create_varbinary_wrapper(from_type);
324
0
    default:
325
0
        break;
326
293k
    }
327
328
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
329
293k
}
330
331
} // namespace CastWrapper
332
333
class PreparedFunctionCast : public PreparedFunctionImpl {
334
public:
335
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
336
377k
            : 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
376k
                        uint32_t result, size_t input_rows_count) const override {
343
376k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
344
376k
    }
345
346
377k
    bool use_default_implementation_for_nulls() const override { return false; }
347
376k
    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
292k
            : name(name_),
358
292k
              argument_types(std::move(argument_types_)),
359
292k
              return_type(std::move(return_type_)) {}
360
361
377k
    const DataTypes& get_argument_types() const override { return argument_types; }
362
377k
    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
377k
                                uint32_t /*result*/) const override {
367
377k
        return std::make_shared<PreparedFunctionCast>(
368
377k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
369
377k
                                                         get_return_type()),
370
377k
                name);
371
377k
    }
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
292k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
388
389
292k
    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
292k
                               const DataTypePtr& return_type) const override {
400
292k
        DataTypes data_types(arguments.size());
401
402
877k
        for (size_t i = 0; i < arguments.size(); ++i) {
403
584k
            data_types[i] = arguments[i].type;
404
584k
        }
405
406
292k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
407
292k
    }
408
409
292k
    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
8
void register_function_cast(SimpleFunctionFactory& factory) {
418
8
    factory.register_function<FunctionBuilderCast>();
419
8
}
420
} // namespace doris