Coverage Report

Created: 2026-03-13 06:52

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/primitive_type.h"
24
#include "exprs/function/cast/cast_to_array.h"
25
#include "exprs/function/cast/cast_to_boolean.h"
26
#include "exprs/function/cast/cast_to_date.h"
27
#include "exprs/function/cast/cast_to_decimal.h"
28
#include "exprs/function/cast/cast_to_float.h"
29
#include "exprs/function/cast/cast_to_int.h"
30
#include "exprs/function/cast/cast_to_ip.h"
31
#include "exprs/function/cast/cast_to_jsonb.h"
32
#include "exprs/function/cast/cast_to_map.h"
33
#include "exprs/function/cast/cast_to_string.h"
34
#include "exprs/function/cast/cast_to_struct.h"
35
#include "exprs/function/cast/cast_to_timestamptz.h"
36
#include "exprs/function/cast/cast_to_variant.h"
37
#include "exprs/function/simple_function_factory.h"
38
39
namespace doris {
40
41
namespace CastWrapper {
42
43
WrapperType create_hll_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
44
0
                               const DataTypeHLL& to_type) {
45
    /// Conversion from String through parsing.
46
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
47
0
        return cast_from_string_to_generic;
48
0
    }
49
50
0
    return CastWrapper::create_unsupport_wrapper("Cast to HLL only support from String type");
51
0
}
52
53
WrapperType create_bitmap_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
54
1
                                  const DataTypeBitMap& to_type) {
55
    /// Conversion from String through parsing.
56
1
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
57
1
        return cast_from_string_to_generic;
58
1
    }
59
60
0
    return CastWrapper::create_unsupport_wrapper("Cast to BitMap only support from String type");
61
1
}
62
63
2
WrapperType create_varbinary_wrapper(const DataTypePtr& from_type_untyped) {
64
    /// Conversion from String through parsing.
65
2
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
66
2
        return cast_from_string_to_generic;
67
2
    }
68
69
0
    return CastWrapper::create_unsupport_wrapper("Cast to Varbinary only support from String type");
70
2
}
71
72
WrapperType prepare_unpack_dictionaries(FunctionContext* context, const DataTypePtr& from_type,
73
364k
                                        const DataTypePtr& to_type) {
74
364k
    const auto& from_nested = from_type;
75
364k
    const auto& to_nested = to_type;
76
77
364k
    if (from_type->is_null_literal()) {
78
1.28k
        if (!to_nested->is_nullable()) {
79
0
            return CastWrapper::create_unsupport_wrapper(
80
0
                    "Cannot convert NULL to a non-nullable type");
81
0
        }
82
83
1.28k
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
84
1.28k
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
85
            /// TODO: remove this in the future.
86
1.28k
            auto& res = block.get_by_position(result);
87
1.28k
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
88
1.28k
                                 ->convert_to_full_column_if_const();
89
1.28k
            return Status::OK();
90
1.28k
        };
91
1.28k
    }
92
93
363k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
94
95
363k
    return wrapper;
96
364k
}
97
98
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
99
341k
                                       const DataTypePtr& to_type) {
100
341k
    if (from_type->equals(*to_type)) {
101
63.8k
        return false;
102
63.8k
    }
103
104
277k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
191k
        using Types = std::decay_t<decltype(types)>;
106
191k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
32.4k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
32.4k
            return false;
112
32.4k
        }
113
0
        return call_on_index_and_data_type<
114
191k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
142k
            using Types2 = std::decay_t<decltype(types2)>;
116
142k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
74.5k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
74.5k
                return false;
121
74.5k
            }
122
39.7k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
39.7k
                using FromFieldType = typename FromDataType::FieldType;
124
39.7k
                using ToFieldType = typename ToDataType::FieldType;
125
39.7k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
39.7k
                UInt32 from_scale = 0;
127
128
39.7k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
15.9k
                    const auto* from_decimal_type =
130
15.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
15.9k
                    from_precision =
132
15.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
15.9k
                    from_scale = from_decimal_type->get_scale();
134
15.9k
                }
135
136
39.7k
                UInt32 to_max_digits = 0;
137
39.7k
                UInt32 to_precision = 0;
138
39.7k
                UInt32 to_scale = 0;
139
140
39.7k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
34.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
34.9k
                    const auto* to_decimal_type =
144
34.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
34.9k
                    to_precision = to_decimal_type->get_precision();
146
34.9k
                    ToDataType::check_type_precision(to_precision);
147
148
34.9k
                    to_scale = to_decimal_type->get_scale();
149
34.9k
                    ToDataType::check_type_scale(to_scale);
150
34.9k
                }
151
39.7k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
4.70k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
4.70k
                    to_precision = to_max_digits;
154
4.70k
                }
155
156
39.7k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
39.7k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
39.7k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
39.7k
                if (to_scale > from_scale) {
161
9.88k
                    multiply_may_overflow &=
162
9.88k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
9.88k
                }
164
39.7k
                return narrow_integral || multiply_may_overflow;
165
39.7k
            }
166
0
            return false;
167
142k
        });
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
114
19
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
19
            using Types2 = std::decay_t<decltype(types2)>;
116
19
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
19
            return false;
167
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
114
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
14
            using Types2 = std::decay_t<decltype(types2)>;
116
14
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
14
            return false;
167
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
114
32
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
32
            using Types2 = std::decay_t<decltype(types2)>;
116
32
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
32
            return false;
167
32
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
114
97
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
97
            using Types2 = std::decay_t<decltype(types2)>;
116
97
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
97
            return false;
167
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
114
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7
            using Types2 = std::decay_t<decltype(types2)>;
116
7
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
7
            return false;
167
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
114
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2
            using Types2 = std::decay_t<decltype(types2)>;
116
2
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
2
            return false;
167
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
114
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7
            using Types2 = std::decay_t<decltype(types2)>;
116
7
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
7
            return false;
167
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
114
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
10
            using Types2 = std::decay_t<decltype(types2)>;
116
10
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
10
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
10
                using FromFieldType = typename FromDataType::FieldType;
124
10
                using ToFieldType = typename ToDataType::FieldType;
125
10
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
10
                UInt32 from_scale = 0;
127
128
10
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
10
                    const auto* from_decimal_type =
130
10
                            check_and_get_data_type<FromDataType>(from_type.get());
131
10
                    from_precision =
132
10
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
10
                    from_scale = from_decimal_type->get_scale();
134
10
                }
135
136
10
                UInt32 to_max_digits = 0;
137
10
                UInt32 to_precision = 0;
138
10
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
10
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
10
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
10
                    to_precision = to_max_digits;
154
10
                }
155
156
10
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
10
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
10
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
10
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
10
                return narrow_integral || multiply_may_overflow;
165
10
            }
166
0
            return false;
167
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
114
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
5
            using Types2 = std::decay_t<decltype(types2)>;
116
5
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
5
                using FromFieldType = typename FromDataType::FieldType;
124
5
                using ToFieldType = typename ToDataType::FieldType;
125
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
5
                UInt32 from_scale = 0;
127
128
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
5
                    const auto* from_decimal_type =
130
5
                            check_and_get_data_type<FromDataType>(from_type.get());
131
5
                    from_precision =
132
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
5
                    from_scale = from_decimal_type->get_scale();
134
5
                }
135
136
5
                UInt32 to_max_digits = 0;
137
5
                UInt32 to_precision = 0;
138
5
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
5
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
5
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
5
                    to_precision = to_max_digits;
154
5
                }
155
156
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
5
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
5
                return narrow_integral || multiply_may_overflow;
165
5
            }
166
0
            return false;
167
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
114
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2
            using Types2 = std::decay_t<decltype(types2)>;
116
2
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
2
                using FromFieldType = typename FromDataType::FieldType;
124
2
                using ToFieldType = typename ToDataType::FieldType;
125
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
2
                UInt32 from_scale = 0;
127
128
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
2
                    const auto* from_decimal_type =
130
2
                            check_and_get_data_type<FromDataType>(from_type.get());
131
2
                    from_precision =
132
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
2
                    from_scale = from_decimal_type->get_scale();
134
2
                }
135
136
2
                UInt32 to_max_digits = 0;
137
2
                UInt32 to_precision = 0;
138
2
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
2
                    to_precision = to_max_digits;
154
2
                }
155
156
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
2
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
2
                return narrow_integral || multiply_may_overflow;
165
2
            }
166
0
            return false;
167
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
114
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
5
            using Types2 = std::decay_t<decltype(types2)>;
116
5
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
5
                using FromFieldType = typename FromDataType::FieldType;
124
5
                using ToFieldType = typename ToDataType::FieldType;
125
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
5
                UInt32 from_scale = 0;
127
128
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
5
                    const auto* from_decimal_type =
130
5
                            check_and_get_data_type<FromDataType>(from_type.get());
131
5
                    from_precision =
132
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
5
                    from_scale = from_decimal_type->get_scale();
134
5
                }
135
136
5
                UInt32 to_max_digits = 0;
137
5
                UInt32 to_precision = 0;
138
5
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
5
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
5
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
5
                    to_precision = to_max_digits;
154
5
                }
155
156
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
5
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
5
                return narrow_integral || multiply_may_overflow;
165
5
            }
166
0
            return false;
167
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
114
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2
            using Types2 = std::decay_t<decltype(types2)>;
116
2
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
2
                using FromFieldType = typename FromDataType::FieldType;
124
2
                using ToFieldType = typename ToDataType::FieldType;
125
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
2
                UInt32 from_scale = 0;
127
128
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
2
                    const auto* from_decimal_type =
130
2
                            check_and_get_data_type<FromDataType>(from_type.get());
131
2
                    from_precision =
132
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
2
                    from_scale = from_decimal_type->get_scale();
134
2
                }
135
136
2
                UInt32 to_max_digits = 0;
137
2
                UInt32 to_precision = 0;
138
2
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
2
                    to_precision = to_max_digits;
154
2
                }
155
156
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
2
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
2
                return narrow_integral || multiply_may_overflow;
165
2
            }
166
0
            return false;
167
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
114
685
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
685
            using Types2 = std::decay_t<decltype(types2)>;
116
685
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
685
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
685
                return false;
121
685
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
685
            return false;
167
685
        });
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
114
303
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
303
            using Types2 = std::decay_t<decltype(types2)>;
116
303
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
303
            return false;
167
303
        });
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
114
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
10
            using Types2 = std::decay_t<decltype(types2)>;
116
10
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
10
            return false;
167
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
114
127
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
127
            using Types2 = std::decay_t<decltype(types2)>;
116
127
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
127
            return false;
167
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
114
273
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
273
            using Types2 = std::decay_t<decltype(types2)>;
116
273
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
273
            return false;
167
273
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
114
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7
            using Types2 = std::decay_t<decltype(types2)>;
116
7
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
7
            return false;
167
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
114
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
23
            using Types2 = std::decay_t<decltype(types2)>;
116
23
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
23
            return false;
167
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
114
28
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
28
            using Types2 = std::decay_t<decltype(types2)>;
116
28
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
28
            return false;
167
28
        });
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
114
19
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
19
            using Types2 = std::decay_t<decltype(types2)>;
116
19
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
19
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
19
                using FromFieldType = typename FromDataType::FieldType;
124
19
                using ToFieldType = typename ToDataType::FieldType;
125
19
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
19
                UInt32 from_scale = 0;
127
128
19
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
19
                    const auto* from_decimal_type =
130
19
                            check_and_get_data_type<FromDataType>(from_type.get());
131
19
                    from_precision =
132
19
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
19
                    from_scale = from_decimal_type->get_scale();
134
19
                }
135
136
19
                UInt32 to_max_digits = 0;
137
19
                UInt32 to_precision = 0;
138
19
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
19
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
19
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
19
                    to_precision = to_max_digits;
154
19
                }
155
156
19
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
19
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
19
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
19
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
19
                return narrow_integral || multiply_may_overflow;
165
19
            }
166
0
            return false;
167
19
        });
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
114
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
24
            using Types2 = std::decay_t<decltype(types2)>;
116
24
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
24
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
24
                using FromFieldType = typename FromDataType::FieldType;
124
24
                using ToFieldType = typename ToDataType::FieldType;
125
24
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
24
                UInt32 from_scale = 0;
127
128
24
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
24
                    const auto* from_decimal_type =
130
24
                            check_and_get_data_type<FromDataType>(from_type.get());
131
24
                    from_precision =
132
24
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
24
                    from_scale = from_decimal_type->get_scale();
134
24
                }
135
136
24
                UInt32 to_max_digits = 0;
137
24
                UInt32 to_precision = 0;
138
24
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
24
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
24
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
24
                    to_precision = to_max_digits;
154
24
                }
155
156
24
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
24
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
24
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
24
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
24
                return narrow_integral || multiply_may_overflow;
165
24
            }
166
0
            return false;
167
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
114
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
8
            using Types2 = std::decay_t<decltype(types2)>;
116
8
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
8
                using FromFieldType = typename FromDataType::FieldType;
124
8
                using ToFieldType = typename ToDataType::FieldType;
125
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
8
                UInt32 from_scale = 0;
127
128
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
8
                    const auto* from_decimal_type =
130
8
                            check_and_get_data_type<FromDataType>(from_type.get());
131
8
                    from_precision =
132
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
8
                    from_scale = from_decimal_type->get_scale();
134
8
                }
135
136
8
                UInt32 to_max_digits = 0;
137
8
                UInt32 to_precision = 0;
138
8
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
8
                    to_precision = to_max_digits;
154
8
                }
155
156
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
8
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
8
                return narrow_integral || multiply_may_overflow;
165
8
            }
166
0
            return false;
167
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
114
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
24
            using Types2 = std::decay_t<decltype(types2)>;
116
24
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
24
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
24
                using FromFieldType = typename FromDataType::FieldType;
124
24
                using ToFieldType = typename ToDataType::FieldType;
125
24
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
24
                UInt32 from_scale = 0;
127
128
24
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
24
                    const auto* from_decimal_type =
130
24
                            check_and_get_data_type<FromDataType>(from_type.get());
131
24
                    from_precision =
132
24
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
24
                    from_scale = from_decimal_type->get_scale();
134
24
                }
135
136
24
                UInt32 to_max_digits = 0;
137
24
                UInt32 to_precision = 0;
138
24
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
24
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
24
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
24
                    to_precision = to_max_digits;
154
24
                }
155
156
24
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
24
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
24
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
24
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
24
                return narrow_integral || multiply_may_overflow;
165
24
            }
166
0
            return false;
167
24
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
114
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
25
            using Types2 = std::decay_t<decltype(types2)>;
116
25
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
25
                using FromFieldType = typename FromDataType::FieldType;
124
25
                using ToFieldType = typename ToDataType::FieldType;
125
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
25
                UInt32 from_scale = 0;
127
128
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
25
                    const auto* from_decimal_type =
130
25
                            check_and_get_data_type<FromDataType>(from_type.get());
131
25
                    from_precision =
132
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
25
                    from_scale = from_decimal_type->get_scale();
134
25
                }
135
136
25
                UInt32 to_max_digits = 0;
137
25
                UInt32 to_precision = 0;
138
25
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
25
                    to_precision = to_max_digits;
154
25
                }
155
156
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
25
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
25
                return narrow_integral || multiply_may_overflow;
165
25
            }
166
0
            return false;
167
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
114
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
72
            using Types2 = std::decay_t<decltype(types2)>;
116
72
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
72
            return false;
167
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
114
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
24
            using Types2 = std::decay_t<decltype(types2)>;
116
24
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
24
            return false;
167
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
114
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
320
            using Types2 = std::decay_t<decltype(types2)>;
116
320
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
320
            return false;
167
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
114
2.33k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.33k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.33k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
2.33k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
2.33k
                return false;
121
2.33k
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
2.33k
            return false;
167
2.33k
        });
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
114
54
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
54
            using Types2 = std::decay_t<decltype(types2)>;
116
54
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
54
            return false;
167
54
        });
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
114
2.03k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.03k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.03k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
2.03k
            return false;
167
2.03k
        });
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
114
138
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
138
            using Types2 = std::decay_t<decltype(types2)>;
116
138
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
138
            return false;
167
138
        });
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
114
100
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
100
            using Types2 = std::decay_t<decltype(types2)>;
116
100
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
100
            return false;
167
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
114
15
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
15
            using Types2 = std::decay_t<decltype(types2)>;
116
15
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
15
            return false;
167
15
        });
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
114
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
21
            using Types2 = std::decay_t<decltype(types2)>;
116
21
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
21
            return false;
167
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
114
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
25
            using Types2 = std::decay_t<decltype(types2)>;
116
25
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
25
            return false;
167
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
114
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
23
            using Types2 = std::decay_t<decltype(types2)>;
116
23
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
23
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
23
                using FromFieldType = typename FromDataType::FieldType;
124
23
                using ToFieldType = typename ToDataType::FieldType;
125
23
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
23
                UInt32 from_scale = 0;
127
128
23
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
23
                    const auto* from_decimal_type =
130
23
                            check_and_get_data_type<FromDataType>(from_type.get());
131
23
                    from_precision =
132
23
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
23
                    from_scale = from_decimal_type->get_scale();
134
23
                }
135
136
23
                UInt32 to_max_digits = 0;
137
23
                UInt32 to_precision = 0;
138
23
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
23
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
23
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
23
                    to_precision = to_max_digits;
154
23
                }
155
156
23
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
23
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
23
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
23
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
23
                return narrow_integral || multiply_may_overflow;
165
23
            }
166
0
            return false;
167
23
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
114
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
25
            using Types2 = std::decay_t<decltype(types2)>;
116
25
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
25
                using FromFieldType = typename FromDataType::FieldType;
124
25
                using ToFieldType = typename ToDataType::FieldType;
125
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
25
                UInt32 from_scale = 0;
127
128
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
25
                    const auto* from_decimal_type =
130
25
                            check_and_get_data_type<FromDataType>(from_type.get());
131
25
                    from_precision =
132
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
25
                    from_scale = from_decimal_type->get_scale();
134
25
                }
135
136
25
                UInt32 to_max_digits = 0;
137
25
                UInt32 to_precision = 0;
138
25
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
25
                    to_precision = to_max_digits;
154
25
                }
155
156
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
25
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
25
                return narrow_integral || multiply_may_overflow;
165
25
            }
166
0
            return false;
167
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
114
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
8
            using Types2 = std::decay_t<decltype(types2)>;
116
8
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
8
                using FromFieldType = typename FromDataType::FieldType;
124
8
                using ToFieldType = typename ToDataType::FieldType;
125
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
8
                UInt32 from_scale = 0;
127
128
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
8
                    const auto* from_decimal_type =
130
8
                            check_and_get_data_type<FromDataType>(from_type.get());
131
8
                    from_precision =
132
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
8
                    from_scale = from_decimal_type->get_scale();
134
8
                }
135
136
8
                UInt32 to_max_digits = 0;
137
8
                UInt32 to_precision = 0;
138
8
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
8
                    to_precision = to_max_digits;
154
8
                }
155
156
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
8
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
8
                return narrow_integral || multiply_may_overflow;
165
8
            }
166
0
            return false;
167
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
114
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
25
            using Types2 = std::decay_t<decltype(types2)>;
116
25
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
25
                using FromFieldType = typename FromDataType::FieldType;
124
25
                using ToFieldType = typename ToDataType::FieldType;
125
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
25
                UInt32 from_scale = 0;
127
128
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
25
                    const auto* from_decimal_type =
130
25
                            check_and_get_data_type<FromDataType>(from_type.get());
131
25
                    from_precision =
132
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
25
                    from_scale = from_decimal_type->get_scale();
134
25
                }
135
136
25
                UInt32 to_max_digits = 0;
137
25
                UInt32 to_precision = 0;
138
25
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
25
                    to_precision = to_max_digits;
154
25
                }
155
156
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
25
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
25
                return narrow_integral || multiply_may_overflow;
165
25
            }
166
0
            return false;
167
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
114
26
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
26
            using Types2 = std::decay_t<decltype(types2)>;
116
26
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
26
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
26
                using FromFieldType = typename FromDataType::FieldType;
124
26
                using ToFieldType = typename ToDataType::FieldType;
125
26
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
26
                UInt32 from_scale = 0;
127
128
26
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
26
                    const auto* from_decimal_type =
130
26
                            check_and_get_data_type<FromDataType>(from_type.get());
131
26
                    from_precision =
132
26
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
26
                    from_scale = from_decimal_type->get_scale();
134
26
                }
135
136
26
                UInt32 to_max_digits = 0;
137
26
                UInt32 to_precision = 0;
138
26
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
26
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
26
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
26
                    to_precision = to_max_digits;
154
26
                }
155
156
26
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
26
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
26
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
26
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
26
                return narrow_integral || multiply_may_overflow;
165
26
            }
166
0
            return false;
167
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
114
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
72
            using Types2 = std::decay_t<decltype(types2)>;
116
72
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
72
            return false;
167
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
114
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
24
            using Types2 = std::decay_t<decltype(types2)>;
116
24
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
24
            return false;
167
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
114
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
320
            using Types2 = std::decay_t<decltype(types2)>;
116
320
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
320
            return false;
167
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
114
2.14k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.14k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.14k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
2.14k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
2.14k
                return false;
121
2.14k
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
2.14k
            return false;
167
2.14k
        });
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
114
44
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
44
            using Types2 = std::decay_t<decltype(types2)>;
116
44
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
44
            return false;
167
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
114
1.54k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.54k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.54k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1.54k
            return false;
167
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
114
378
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
378
            using Types2 = std::decay_t<decltype(types2)>;
116
378
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
378
            return false;
167
378
        });
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
114
1.53k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.53k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.53k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1.53k
            return false;
167
1.53k
        });
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
114
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
13
            using Types2 = std::decay_t<decltype(types2)>;
116
13
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
13
            return false;
167
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
114
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
20
            using Types2 = std::decay_t<decltype(types2)>;
116
20
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
20
            return false;
167
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
114
94
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
94
            using Types2 = std::decay_t<decltype(types2)>;
116
94
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
94
            return false;
167
94
        });
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
114
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
21
            using Types2 = std::decay_t<decltype(types2)>;
116
21
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
21
                using FromFieldType = typename FromDataType::FieldType;
124
21
                using ToFieldType = typename ToDataType::FieldType;
125
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
21
                UInt32 from_scale = 0;
127
128
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
21
                    const auto* from_decimal_type =
130
21
                            check_and_get_data_type<FromDataType>(from_type.get());
131
21
                    from_precision =
132
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
21
                    from_scale = from_decimal_type->get_scale();
134
21
                }
135
136
21
                UInt32 to_max_digits = 0;
137
21
                UInt32 to_precision = 0;
138
21
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
21
                    to_precision = to_max_digits;
154
21
                }
155
156
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
21
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
21
                return narrow_integral || multiply_may_overflow;
165
21
            }
166
0
            return false;
167
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
114
38
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
38
            using Types2 = std::decay_t<decltype(types2)>;
116
38
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
38
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
38
                using FromFieldType = typename FromDataType::FieldType;
124
38
                using ToFieldType = typename ToDataType::FieldType;
125
38
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
38
                UInt32 from_scale = 0;
127
128
38
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
38
                    const auto* from_decimal_type =
130
38
                            check_and_get_data_type<FromDataType>(from_type.get());
131
38
                    from_precision =
132
38
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
38
                    from_scale = from_decimal_type->get_scale();
134
38
                }
135
136
38
                UInt32 to_max_digits = 0;
137
38
                UInt32 to_precision = 0;
138
38
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
38
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
38
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
38
                    to_precision = to_max_digits;
154
38
                }
155
156
38
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
38
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
38
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
38
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
38
                return narrow_integral || multiply_may_overflow;
165
38
            }
166
0
            return false;
167
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
114
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
8
            using Types2 = std::decay_t<decltype(types2)>;
116
8
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
8
                using FromFieldType = typename FromDataType::FieldType;
124
8
                using ToFieldType = typename ToDataType::FieldType;
125
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
8
                UInt32 from_scale = 0;
127
128
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
8
                    const auto* from_decimal_type =
130
8
                            check_and_get_data_type<FromDataType>(from_type.get());
131
8
                    from_precision =
132
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
8
                    from_scale = from_decimal_type->get_scale();
134
8
                }
135
136
8
                UInt32 to_max_digits = 0;
137
8
                UInt32 to_precision = 0;
138
8
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
8
                    to_precision = to_max_digits;
154
8
                }
155
156
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
8
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
8
                return narrow_integral || multiply_may_overflow;
165
8
            }
166
0
            return false;
167
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
114
137
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
137
            using Types2 = std::decay_t<decltype(types2)>;
116
137
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
137
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
137
                using FromFieldType = typename FromDataType::FieldType;
124
137
                using ToFieldType = typename ToDataType::FieldType;
125
137
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
137
                UInt32 from_scale = 0;
127
128
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
137
                    const auto* from_decimal_type =
130
137
                            check_and_get_data_type<FromDataType>(from_type.get());
131
137
                    from_precision =
132
137
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
137
                    from_scale = from_decimal_type->get_scale();
134
137
                }
135
136
137
                UInt32 to_max_digits = 0;
137
137
                UInt32 to_precision = 0;
138
137
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
137
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
137
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
137
                    to_precision = to_max_digits;
154
137
                }
155
156
137
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
137
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
137
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
137
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
137
                return narrow_integral || multiply_may_overflow;
165
137
            }
166
0
            return false;
167
137
        });
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
114
22
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
22
            using Types2 = std::decay_t<decltype(types2)>;
116
22
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
22
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
22
                using FromFieldType = typename FromDataType::FieldType;
124
22
                using ToFieldType = typename ToDataType::FieldType;
125
22
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
22
                UInt32 from_scale = 0;
127
128
22
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
22
                    const auto* from_decimal_type =
130
22
                            check_and_get_data_type<FromDataType>(from_type.get());
131
22
                    from_precision =
132
22
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
22
                    from_scale = from_decimal_type->get_scale();
134
22
                }
135
136
22
                UInt32 to_max_digits = 0;
137
22
                UInt32 to_precision = 0;
138
22
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
22
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
22
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
22
                    to_precision = to_max_digits;
154
22
                }
155
156
22
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
22
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
22
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
22
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
22
                return narrow_integral || multiply_may_overflow;
165
22
            }
166
0
            return false;
167
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
114
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
16
            using Types2 = std::decay_t<decltype(types2)>;
116
16
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
16
            return false;
167
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
114
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
24
            using Types2 = std::decay_t<decltype(types2)>;
116
24
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
24
            return false;
167
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
114
276
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
276
            using Types2 = std::decay_t<decltype(types2)>;
116
276
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
276
            return false;
167
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
114
17.3k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
17.3k
            using Types2 = std::decay_t<decltype(types2)>;
116
17.3k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
17.3k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
17.3k
                return false;
121
17.3k
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
17.3k
            return false;
167
17.3k
        });
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
114
358
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
358
            using Types2 = std::decay_t<decltype(types2)>;
116
358
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
358
            return false;
167
358
        });
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
114
1.00k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.00k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.00k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1.00k
            return false;
167
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
114
586
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
586
            using Types2 = std::decay_t<decltype(types2)>;
116
586
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
586
            return false;
167
586
        });
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
114
5.19k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
5.19k
            using Types2 = std::decay_t<decltype(types2)>;
116
5.19k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
5.19k
            return false;
167
5.19k
        });
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
114
290
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
290
            using Types2 = std::decay_t<decltype(types2)>;
116
290
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
290
            return false;
167
290
        });
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
114
632
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
632
            using Types2 = std::decay_t<decltype(types2)>;
116
632
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
632
            return false;
167
632
        });
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
114
2.31k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.31k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.31k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
2.31k
            return false;
167
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
114
313
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
313
            using Types2 = std::decay_t<decltype(types2)>;
116
313
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
313
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
313
                using FromFieldType = typename FromDataType::FieldType;
124
313
                using ToFieldType = typename ToDataType::FieldType;
125
313
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
313
                UInt32 from_scale = 0;
127
128
313
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
313
                    const auto* from_decimal_type =
130
313
                            check_and_get_data_type<FromDataType>(from_type.get());
131
313
                    from_precision =
132
313
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
313
                    from_scale = from_decimal_type->get_scale();
134
313
                }
135
136
313
                UInt32 to_max_digits = 0;
137
313
                UInt32 to_precision = 0;
138
313
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
313
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
313
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
313
                    to_precision = to_max_digits;
154
313
                }
155
156
313
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
313
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
313
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
313
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
313
                return narrow_integral || multiply_may_overflow;
165
313
            }
166
0
            return false;
167
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
114
318
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
318
            using Types2 = std::decay_t<decltype(types2)>;
116
318
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
318
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
318
                using FromFieldType = typename FromDataType::FieldType;
124
318
                using ToFieldType = typename ToDataType::FieldType;
125
318
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
318
                UInt32 from_scale = 0;
127
128
318
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
318
                    const auto* from_decimal_type =
130
318
                            check_and_get_data_type<FromDataType>(from_type.get());
131
318
                    from_precision =
132
318
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
318
                    from_scale = from_decimal_type->get_scale();
134
318
                }
135
136
318
                UInt32 to_max_digits = 0;
137
318
                UInt32 to_precision = 0;
138
318
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
318
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
318
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
318
                    to_precision = to_max_digits;
154
318
                }
155
156
318
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
318
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
318
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
318
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
318
                return narrow_integral || multiply_may_overflow;
165
318
            }
166
0
            return false;
167
318
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
114
304
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
304
            using Types2 = std::decay_t<decltype(types2)>;
116
304
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
304
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
304
                using FromFieldType = typename FromDataType::FieldType;
124
304
                using ToFieldType = typename ToDataType::FieldType;
125
304
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
304
                UInt32 from_scale = 0;
127
128
304
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
304
                    const auto* from_decimal_type =
130
304
                            check_and_get_data_type<FromDataType>(from_type.get());
131
304
                    from_precision =
132
304
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
304
                    from_scale = from_decimal_type->get_scale();
134
304
                }
135
136
304
                UInt32 to_max_digits = 0;
137
304
                UInt32 to_precision = 0;
138
304
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
304
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
304
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
304
                    to_precision = to_max_digits;
154
304
                }
155
156
304
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
304
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
304
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
304
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
304
                return narrow_integral || multiply_may_overflow;
165
304
            }
166
0
            return false;
167
304
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
114
614
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
614
            using Types2 = std::decay_t<decltype(types2)>;
116
614
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
614
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
614
                using FromFieldType = typename FromDataType::FieldType;
124
614
                using ToFieldType = typename ToDataType::FieldType;
125
614
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
614
                UInt32 from_scale = 0;
127
128
614
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
614
                    const auto* from_decimal_type =
130
614
                            check_and_get_data_type<FromDataType>(from_type.get());
131
614
                    from_precision =
132
614
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
614
                    from_scale = from_decimal_type->get_scale();
134
614
                }
135
136
614
                UInt32 to_max_digits = 0;
137
614
                UInt32 to_precision = 0;
138
614
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
614
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
614
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
614
                    to_precision = to_max_digits;
154
614
                }
155
156
614
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
614
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
614
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
614
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
614
                return narrow_integral || multiply_may_overflow;
165
614
            }
166
0
            return false;
167
614
        });
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
114
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
21
            using Types2 = std::decay_t<decltype(types2)>;
116
21
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
21
                using FromFieldType = typename FromDataType::FieldType;
124
21
                using ToFieldType = typename ToDataType::FieldType;
125
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
21
                UInt32 from_scale = 0;
127
128
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
21
                    const auto* from_decimal_type =
130
21
                            check_and_get_data_type<FromDataType>(from_type.get());
131
21
                    from_precision =
132
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
21
                    from_scale = from_decimal_type->get_scale();
134
21
                }
135
136
21
                UInt32 to_max_digits = 0;
137
21
                UInt32 to_precision = 0;
138
21
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
21
                    to_precision = to_max_digits;
154
21
                }
155
156
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
21
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
21
                return narrow_integral || multiply_may_overflow;
165
21
            }
166
0
            return false;
167
21
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
114
1.25k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.25k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.25k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1.25k
            return false;
167
1.25k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
114
1.26k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.26k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.26k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1.26k
            return false;
167
1.26k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
114
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
4
            using Types2 = std::decay_t<decltype(types2)>;
116
4
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
4
            return false;
167
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
114
18.1k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
18.1k
            using Types2 = std::decay_t<decltype(types2)>;
116
18.1k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
18.1k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
18.1k
                return false;
121
18.1k
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
18.1k
            return false;
167
18.1k
        });
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
114
142
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
142
            using Types2 = std::decay_t<decltype(types2)>;
116
142
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
142
            return false;
167
142
        });
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
114
109
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
109
            using Types2 = std::decay_t<decltype(types2)>;
116
109
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
109
            return false;
167
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
114
79
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
79
            using Types2 = std::decay_t<decltype(types2)>;
116
79
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
79
            return false;
167
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
114
135
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
135
            using Types2 = std::decay_t<decltype(types2)>;
116
135
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
135
            return false;
167
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
114
602
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
602
            using Types2 = std::decay_t<decltype(types2)>;
116
602
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
602
            return false;
167
602
        });
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
114
9
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
9
            using Types2 = std::decay_t<decltype(types2)>;
116
9
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
9
            return false;
167
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
114
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
13
            using Types2 = std::decay_t<decltype(types2)>;
116
13
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
13
            return false;
167
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
114
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
18
            using Types2 = std::decay_t<decltype(types2)>;
116
18
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
18
                using FromFieldType = typename FromDataType::FieldType;
124
18
                using ToFieldType = typename ToDataType::FieldType;
125
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
18
                UInt32 from_scale = 0;
127
128
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
18
                    const auto* from_decimal_type =
130
18
                            check_and_get_data_type<FromDataType>(from_type.get());
131
18
                    from_precision =
132
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
18
                    from_scale = from_decimal_type->get_scale();
134
18
                }
135
136
18
                UInt32 to_max_digits = 0;
137
18
                UInt32 to_precision = 0;
138
18
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
18
                    to_precision = to_max_digits;
154
18
                }
155
156
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
18
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
18
                return narrow_integral || multiply_may_overflow;
165
18
            }
166
0
            return false;
167
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
114
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
21
            using Types2 = std::decay_t<decltype(types2)>;
116
21
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
21
                using FromFieldType = typename FromDataType::FieldType;
124
21
                using ToFieldType = typename ToDataType::FieldType;
125
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
21
                UInt32 from_scale = 0;
127
128
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
21
                    const auto* from_decimal_type =
130
21
                            check_and_get_data_type<FromDataType>(from_type.get());
131
21
                    from_precision =
132
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
21
                    from_scale = from_decimal_type->get_scale();
134
21
                }
135
136
21
                UInt32 to_max_digits = 0;
137
21
                UInt32 to_precision = 0;
138
21
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
21
                    to_precision = to_max_digits;
154
21
                }
155
156
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
21
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
21
                return narrow_integral || multiply_may_overflow;
165
21
            }
166
0
            return false;
167
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
114
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
8
            using Types2 = std::decay_t<decltype(types2)>;
116
8
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
8
                using FromFieldType = typename FromDataType::FieldType;
124
8
                using ToFieldType = typename ToDataType::FieldType;
125
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
8
                UInt32 from_scale = 0;
127
128
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
8
                    const auto* from_decimal_type =
130
8
                            check_and_get_data_type<FromDataType>(from_type.get());
131
8
                    from_precision =
132
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
8
                    from_scale = from_decimal_type->get_scale();
134
8
                }
135
136
8
                UInt32 to_max_digits = 0;
137
8
                UInt32 to_precision = 0;
138
8
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
8
                    to_precision = to_max_digits;
154
8
                }
155
156
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
8
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
8
                return narrow_integral || multiply_may_overflow;
165
8
            }
166
0
            return false;
167
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
114
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
21
            using Types2 = std::decay_t<decltype(types2)>;
116
21
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
21
                using FromFieldType = typename FromDataType::FieldType;
124
21
                using ToFieldType = typename ToDataType::FieldType;
125
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
21
                UInt32 from_scale = 0;
127
128
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
21
                    const auto* from_decimal_type =
130
21
                            check_and_get_data_type<FromDataType>(from_type.get());
131
21
                    from_precision =
132
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
21
                    from_scale = from_decimal_type->get_scale();
134
21
                }
135
136
21
                UInt32 to_max_digits = 0;
137
21
                UInt32 to_precision = 0;
138
21
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
21
                    to_precision = to_max_digits;
154
21
                }
155
156
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
21
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
21
                return narrow_integral || multiply_may_overflow;
165
21
            }
166
0
            return false;
167
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
114
441
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
441
            using Types2 = std::decay_t<decltype(types2)>;
116
441
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
441
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
441
                using FromFieldType = typename FromDataType::FieldType;
124
441
                using ToFieldType = typename ToDataType::FieldType;
125
441
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
441
                UInt32 from_scale = 0;
127
128
441
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
441
                    const auto* from_decimal_type =
130
441
                            check_and_get_data_type<FromDataType>(from_type.get());
131
441
                    from_precision =
132
441
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
441
                    from_scale = from_decimal_type->get_scale();
134
441
                }
135
136
441
                UInt32 to_max_digits = 0;
137
441
                UInt32 to_precision = 0;
138
441
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
441
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
441
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
441
                    to_precision = to_max_digits;
154
441
                }
155
156
441
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
441
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
441
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
441
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
441
                return narrow_integral || multiply_may_overflow;
165
441
            }
166
0
            return false;
167
441
        });
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
114
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2
            using Types2 = std::decay_t<decltype(types2)>;
116
2
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
2
            return false;
167
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
114
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
16
            using Types2 = std::decay_t<decltype(types2)>;
116
16
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
16
            return false;
167
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
114
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
4
            using Types2 = std::decay_t<decltype(types2)>;
116
4
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
4
            return false;
167
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
114
1.89k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.89k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.89k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
1.89k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1.89k
                return false;
121
1.89k
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1.89k
            return false;
167
1.89k
        });
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
114
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2
            using Types2 = std::decay_t<decltype(types2)>;
116
2
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
2
            return false;
167
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
114
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
29
            using Types2 = std::decay_t<decltype(types2)>;
116
29
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
29
            return false;
167
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
114
6
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
6
            using Types2 = std::decay_t<decltype(types2)>;
116
6
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
6
            return false;
167
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
114
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
18
            using Types2 = std::decay_t<decltype(types2)>;
116
18
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
18
            return false;
167
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
114
6
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
6
            using Types2 = std::decay_t<decltype(types2)>;
116
6
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
6
            return false;
167
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
114
64
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
64
            using Types2 = std::decay_t<decltype(types2)>;
116
64
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
64
            return false;
167
64
        });
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
114
89
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
89
            using Types2 = std::decay_t<decltype(types2)>;
116
89
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
89
            return false;
167
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
114
117
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
117
            using Types2 = std::decay_t<decltype(types2)>;
116
117
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
117
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
117
                using FromFieldType = typename FromDataType::FieldType;
124
117
                using ToFieldType = typename ToDataType::FieldType;
125
117
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
117
                UInt32 from_scale = 0;
127
128
117
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
117
                    const auto* from_decimal_type =
130
117
                            check_and_get_data_type<FromDataType>(from_type.get());
131
117
                    from_precision =
132
117
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
117
                    from_scale = from_decimal_type->get_scale();
134
117
                }
135
136
117
                UInt32 to_max_digits = 0;
137
117
                UInt32 to_precision = 0;
138
117
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
117
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
117
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
117
                    to_precision = to_max_digits;
154
117
                }
155
156
117
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
117
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
117
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
117
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
117
                return narrow_integral || multiply_may_overflow;
165
117
            }
166
0
            return false;
167
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
114
112
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
112
            using Types2 = std::decay_t<decltype(types2)>;
116
112
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
112
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
112
                using FromFieldType = typename FromDataType::FieldType;
124
112
                using ToFieldType = typename ToDataType::FieldType;
125
112
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
112
                UInt32 from_scale = 0;
127
128
112
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
112
                    const auto* from_decimal_type =
130
112
                            check_and_get_data_type<FromDataType>(from_type.get());
131
112
                    from_precision =
132
112
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
112
                    from_scale = from_decimal_type->get_scale();
134
112
                }
135
136
112
                UInt32 to_max_digits = 0;
137
112
                UInt32 to_precision = 0;
138
112
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
112
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
112
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
112
                    to_precision = to_max_digits;
154
112
                }
155
156
112
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
112
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
112
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
112
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
112
                return narrow_integral || multiply_may_overflow;
165
112
            }
166
0
            return false;
167
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
114
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
14
            using Types2 = std::decay_t<decltype(types2)>;
116
14
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
14
                using FromFieldType = typename FromDataType::FieldType;
124
14
                using ToFieldType = typename ToDataType::FieldType;
125
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
14
                UInt32 from_scale = 0;
127
128
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
14
                    const auto* from_decimal_type =
130
14
                            check_and_get_data_type<FromDataType>(from_type.get());
131
14
                    from_precision =
132
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
14
                    from_scale = from_decimal_type->get_scale();
134
14
                }
135
136
14
                UInt32 to_max_digits = 0;
137
14
                UInt32 to_precision = 0;
138
14
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
14
                    to_precision = to_max_digits;
154
14
                }
155
156
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
14
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
14
                return narrow_integral || multiply_may_overflow;
165
14
            }
166
0
            return false;
167
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
114
63
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
63
            using Types2 = std::decay_t<decltype(types2)>;
116
63
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
63
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
63
                using FromFieldType = typename FromDataType::FieldType;
124
63
                using ToFieldType = typename ToDataType::FieldType;
125
63
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
63
                UInt32 from_scale = 0;
127
128
63
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
63
                    const auto* from_decimal_type =
130
63
                            check_and_get_data_type<FromDataType>(from_type.get());
131
63
                    from_precision =
132
63
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
63
                    from_scale = from_decimal_type->get_scale();
134
63
                }
135
136
63
                UInt32 to_max_digits = 0;
137
63
                UInt32 to_precision = 0;
138
63
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
63
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
63
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
63
                    to_precision = to_max_digits;
154
63
                }
155
156
63
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
63
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
63
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
63
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
63
                return narrow_integral || multiply_may_overflow;
165
63
            }
166
0
            return false;
167
63
        });
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
114
295
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
295
            using Types2 = std::decay_t<decltype(types2)>;
116
295
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
295
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
295
                using FromFieldType = typename FromDataType::FieldType;
124
295
                using ToFieldType = typename ToDataType::FieldType;
125
295
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
295
                UInt32 from_scale = 0;
127
128
295
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
295
                    const auto* from_decimal_type =
130
295
                            check_and_get_data_type<FromDataType>(from_type.get());
131
295
                    from_precision =
132
295
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
295
                    from_scale = from_decimal_type->get_scale();
134
295
                }
135
136
295
                UInt32 to_max_digits = 0;
137
295
                UInt32 to_precision = 0;
138
295
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
295
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
295
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
295
                    to_precision = to_max_digits;
154
295
                }
155
156
295
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
295
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
295
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
295
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
295
                return narrow_integral || multiply_may_overflow;
165
295
            }
166
0
            return false;
167
295
        });
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
114
39
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
39
            using Types2 = std::decay_t<decltype(types2)>;
116
39
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
39
            return false;
167
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
114
7.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7.78k
            using Types2 = std::decay_t<decltype(types2)>;
116
7.78k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
7.78k
            return false;
167
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
114
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
162
            using Types2 = std::decay_t<decltype(types2)>;
116
162
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
162
            return false;
167
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
114
1.23k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.23k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.23k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
1.23k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1.23k
                return false;
121
1.23k
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1.23k
            return false;
167
1.23k
        });
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
114
260
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
260
            using Types2 = std::decay_t<decltype(types2)>;
116
260
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
260
            return false;
167
260
        });
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
114
463
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
463
            using Types2 = std::decay_t<decltype(types2)>;
116
463
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
463
            return false;
167
463
        });
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
114
1.01k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.01k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.01k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1.01k
            return false;
167
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
114
1.08k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.08k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.08k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1.08k
            return false;
167
1.08k
        });
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
114
1.18k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.18k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.18k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1.18k
            return false;
167
1.18k
        });
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
114
198
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
198
            using Types2 = std::decay_t<decltype(types2)>;
116
198
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
198
            return false;
167
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
114
1.15k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.15k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.15k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1.15k
            return false;
167
1.15k
        });
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
114
456
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
456
            using Types2 = std::decay_t<decltype(types2)>;
116
456
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
456
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
456
                using FromFieldType = typename FromDataType::FieldType;
124
456
                using ToFieldType = typename ToDataType::FieldType;
125
456
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
456
                UInt32 from_scale = 0;
127
128
456
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
456
                    const auto* from_decimal_type =
130
456
                            check_and_get_data_type<FromDataType>(from_type.get());
131
456
                    from_precision =
132
456
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
456
                    from_scale = from_decimal_type->get_scale();
134
456
                }
135
136
456
                UInt32 to_max_digits = 0;
137
456
                UInt32 to_precision = 0;
138
456
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
456
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
456
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
456
                    to_precision = to_max_digits;
154
456
                }
155
156
456
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
456
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
456
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
456
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
457
                return narrow_integral || multiply_may_overflow;
165
456
            }
166
0
            return false;
167
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
114
326
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
326
            using Types2 = std::decay_t<decltype(types2)>;
116
326
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
326
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
326
                using FromFieldType = typename FromDataType::FieldType;
124
326
                using ToFieldType = typename ToDataType::FieldType;
125
326
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
326
                UInt32 from_scale = 0;
127
128
326
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
326
                    const auto* from_decimal_type =
130
326
                            check_and_get_data_type<FromDataType>(from_type.get());
131
326
                    from_precision =
132
326
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
326
                    from_scale = from_decimal_type->get_scale();
134
326
                }
135
136
326
                UInt32 to_max_digits = 0;
137
326
                UInt32 to_precision = 0;
138
326
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
326
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
326
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
326
                    to_precision = to_max_digits;
154
326
                }
155
156
326
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
326
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
326
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
326
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
327
                return narrow_integral || multiply_may_overflow;
165
326
            }
166
0
            return false;
167
326
        });
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
114
54
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
54
            using Types2 = std::decay_t<decltype(types2)>;
116
54
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
54
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
54
                using FromFieldType = typename FromDataType::FieldType;
124
54
                using ToFieldType = typename ToDataType::FieldType;
125
54
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
54
                UInt32 from_scale = 0;
127
128
54
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
54
                    const auto* from_decimal_type =
130
54
                            check_and_get_data_type<FromDataType>(from_type.get());
131
54
                    from_precision =
132
54
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
54
                    from_scale = from_decimal_type->get_scale();
134
54
                }
135
136
54
                UInt32 to_max_digits = 0;
137
54
                UInt32 to_precision = 0;
138
54
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
54
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
54
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
54
                    to_precision = to_max_digits;
154
54
                }
155
156
54
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
54
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
54
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
54
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
54
                return narrow_integral || multiply_may_overflow;
165
54
            }
166
0
            return false;
167
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
114
429
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
429
            using Types2 = std::decay_t<decltype(types2)>;
116
429
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
429
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
429
                using FromFieldType = typename FromDataType::FieldType;
124
429
                using ToFieldType = typename ToDataType::FieldType;
125
429
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
429
                UInt32 from_scale = 0;
127
128
429
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
429
                    const auto* from_decimal_type =
130
429
                            check_and_get_data_type<FromDataType>(from_type.get());
131
429
                    from_precision =
132
429
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
429
                    from_scale = from_decimal_type->get_scale();
134
429
                }
135
136
429
                UInt32 to_max_digits = 0;
137
429
                UInt32 to_precision = 0;
138
429
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
429
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
429
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
429
                    to_precision = to_max_digits;
154
429
                }
155
156
429
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
429
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
429
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
429
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
429
                return narrow_integral || multiply_may_overflow;
165
429
            }
166
0
            return false;
167
429
        });
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
114
284
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
284
            using Types2 = std::decay_t<decltype(types2)>;
116
284
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
284
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
284
                using FromFieldType = typename FromDataType::FieldType;
124
284
                using ToFieldType = typename ToDataType::FieldType;
125
284
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
284
                UInt32 from_scale = 0;
127
128
284
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
284
                    const auto* from_decimal_type =
130
284
                            check_and_get_data_type<FromDataType>(from_type.get());
131
284
                    from_precision =
132
284
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
284
                    from_scale = from_decimal_type->get_scale();
134
284
                }
135
136
284
                UInt32 to_max_digits = 0;
137
284
                UInt32 to_precision = 0;
138
284
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
284
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
284
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
284
                    to_precision = to_max_digits;
154
284
                }
155
156
284
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
284
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
284
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
284
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
284
                return narrow_integral || multiply_may_overflow;
165
284
            }
166
0
            return false;
167
284
        });
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
114
58
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
58
            using Types2 = std::decay_t<decltype(types2)>;
116
58
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
58
            return false;
167
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
114
7.80k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7.80k
            using Types2 = std::decay_t<decltype(types2)>;
116
7.80k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
7.80k
            return false;
167
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
114
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
162
            using Types2 = std::decay_t<decltype(types2)>;
116
162
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
162
            return false;
167
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
114
5.68k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
5.68k
            using Types2 = std::decay_t<decltype(types2)>;
116
5.68k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
5.68k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
5.68k
                return false;
121
5.68k
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
5.68k
            return false;
167
5.68k
        });
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
114
19
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
19
            using Types2 = std::decay_t<decltype(types2)>;
116
19
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
19
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
19
                using FromFieldType = typename FromDataType::FieldType;
124
19
                using ToFieldType = typename ToDataType::FieldType;
125
19
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
19
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
19
                UInt32 to_max_digits = 0;
137
19
                UInt32 to_precision = 0;
138
19
                UInt32 to_scale = 0;
139
140
19
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
19
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
19
                    const auto* to_decimal_type =
144
19
                            check_and_get_data_type<ToDataType>(to_type.get());
145
19
                    to_precision = to_decimal_type->get_precision();
146
19
                    ToDataType::check_type_precision(to_precision);
147
148
19
                    to_scale = to_decimal_type->get_scale();
149
19
                    ToDataType::check_type_scale(to_scale);
150
19
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
19
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
19
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
19
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
19
                if (to_scale > from_scale) {
161
18
                    multiply_may_overflow &=
162
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
18
                }
164
19
                return narrow_integral || multiply_may_overflow;
165
19
            }
166
0
            return false;
167
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
114
357
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
357
            using Types2 = std::decay_t<decltype(types2)>;
116
357
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
357
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
357
                using FromFieldType = typename FromDataType::FieldType;
124
357
                using ToFieldType = typename ToDataType::FieldType;
125
357
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
357
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
357
                UInt32 to_max_digits = 0;
137
357
                UInt32 to_precision = 0;
138
357
                UInt32 to_scale = 0;
139
140
357
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
357
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
357
                    const auto* to_decimal_type =
144
357
                            check_and_get_data_type<ToDataType>(to_type.get());
145
357
                    to_precision = to_decimal_type->get_precision();
146
357
                    ToDataType::check_type_precision(to_precision);
147
148
357
                    to_scale = to_decimal_type->get_scale();
149
357
                    ToDataType::check_type_scale(to_scale);
150
357
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
357
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
357
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
357
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
357
                if (to_scale > from_scale) {
161
224
                    multiply_may_overflow &=
162
224
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
224
                }
164
357
                return narrow_integral || multiply_may_overflow;
165
357
            }
166
0
            return false;
167
357
        });
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
114
353
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
353
            using Types2 = std::decay_t<decltype(types2)>;
116
353
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
353
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
353
                using FromFieldType = typename FromDataType::FieldType;
124
353
                using ToFieldType = typename ToDataType::FieldType;
125
353
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
353
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
353
                UInt32 to_max_digits = 0;
137
353
                UInt32 to_precision = 0;
138
353
                UInt32 to_scale = 0;
139
140
353
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
353
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
353
                    const auto* to_decimal_type =
144
353
                            check_and_get_data_type<ToDataType>(to_type.get());
145
353
                    to_precision = to_decimal_type->get_precision();
146
353
                    ToDataType::check_type_precision(to_precision);
147
148
353
                    to_scale = to_decimal_type->get_scale();
149
353
                    ToDataType::check_type_scale(to_scale);
150
353
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
353
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
353
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
353
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
353
                if (to_scale > from_scale) {
161
182
                    multiply_may_overflow &=
162
182
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
182
                }
164
353
                return narrow_integral || multiply_may_overflow;
165
353
            }
166
0
            return false;
167
353
        });
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
114
365
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
365
            using Types2 = std::decay_t<decltype(types2)>;
116
365
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
365
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
365
                using FromFieldType = typename FromDataType::FieldType;
124
365
                using ToFieldType = typename ToDataType::FieldType;
125
365
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
365
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
365
                UInt32 to_max_digits = 0;
137
365
                UInt32 to_precision = 0;
138
365
                UInt32 to_scale = 0;
139
140
365
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
365
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
365
                    const auto* to_decimal_type =
144
365
                            check_and_get_data_type<ToDataType>(to_type.get());
145
365
                    to_precision = to_decimal_type->get_precision();
146
365
                    ToDataType::check_type_precision(to_precision);
147
148
365
                    to_scale = to_decimal_type->get_scale();
149
365
                    ToDataType::check_type_scale(to_scale);
150
365
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
365
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
365
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
365
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
365
                if (to_scale > from_scale) {
161
188
                    multiply_may_overflow &=
162
188
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
188
                }
164
365
                return narrow_integral || multiply_may_overflow;
165
365
            }
166
0
            return false;
167
365
        });
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
114
424
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
424
            using Types2 = std::decay_t<decltype(types2)>;
116
424
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
424
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
424
                using FromFieldType = typename FromDataType::FieldType;
124
424
                using ToFieldType = typename ToDataType::FieldType;
125
424
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
424
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
424
                UInt32 to_max_digits = 0;
137
424
                UInt32 to_precision = 0;
138
424
                UInt32 to_scale = 0;
139
140
424
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
424
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
424
                    const auto* to_decimal_type =
144
424
                            check_and_get_data_type<ToDataType>(to_type.get());
145
424
                    to_precision = to_decimal_type->get_precision();
146
424
                    ToDataType::check_type_precision(to_precision);
147
148
424
                    to_scale = to_decimal_type->get_scale();
149
424
                    ToDataType::check_type_scale(to_scale);
150
424
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
424
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
424
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
424
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
424
                if (to_scale > from_scale) {
161
174
                    multiply_may_overflow &=
162
174
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
174
                }
164
424
                return narrow_integral || multiply_may_overflow;
165
424
            }
166
0
            return false;
167
424
        });
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
114
361
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
361
            using Types2 = std::decay_t<decltype(types2)>;
116
361
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
361
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
361
                using FromFieldType = typename FromDataType::FieldType;
124
361
                using ToFieldType = typename ToDataType::FieldType;
125
361
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
361
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
361
                UInt32 to_max_digits = 0;
137
361
                UInt32 to_precision = 0;
138
361
                UInt32 to_scale = 0;
139
140
361
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
361
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
361
                    const auto* to_decimal_type =
144
361
                            check_and_get_data_type<ToDataType>(to_type.get());
145
361
                    to_precision = to_decimal_type->get_precision();
146
361
                    ToDataType::check_type_precision(to_precision);
147
148
361
                    to_scale = to_decimal_type->get_scale();
149
361
                    ToDataType::check_type_scale(to_scale);
150
361
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
361
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
361
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
361
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
361
                if (to_scale > from_scale) {
161
186
                    multiply_may_overflow &=
162
186
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
186
                }
164
361
                return narrow_integral || multiply_may_overflow;
165
361
            }
166
0
            return false;
167
361
        });
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
114
104
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
104
            using Types2 = std::decay_t<decltype(types2)>;
116
104
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
104
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
104
                using FromFieldType = typename FromDataType::FieldType;
124
104
                using ToFieldType = typename ToDataType::FieldType;
125
104
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
104
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
104
                UInt32 to_max_digits = 0;
137
104
                UInt32 to_precision = 0;
138
104
                UInt32 to_scale = 0;
139
140
104
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
104
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
104
                    const auto* to_decimal_type =
144
104
                            check_and_get_data_type<ToDataType>(to_type.get());
145
104
                    to_precision = to_decimal_type->get_precision();
146
104
                    ToDataType::check_type_precision(to_precision);
147
148
104
                    to_scale = to_decimal_type->get_scale();
149
104
                    ToDataType::check_type_scale(to_scale);
150
104
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
104
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
104
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
104
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
104
                if (to_scale > from_scale) {
161
68
                    multiply_may_overflow &=
162
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
68
                }
164
104
                return narrow_integral || multiply_may_overflow;
165
104
            }
166
0
            return false;
167
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
114
308
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
308
            using Types2 = std::decay_t<decltype(types2)>;
116
308
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
308
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
308
                using FromFieldType = typename FromDataType::FieldType;
124
308
                using ToFieldType = typename ToDataType::FieldType;
125
308
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
308
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
308
                UInt32 to_max_digits = 0;
137
308
                UInt32 to_precision = 0;
138
308
                UInt32 to_scale = 0;
139
140
308
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
308
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
308
                    const auto* to_decimal_type =
144
308
                            check_and_get_data_type<ToDataType>(to_type.get());
145
308
                    to_precision = to_decimal_type->get_precision();
146
308
                    ToDataType::check_type_precision(to_precision);
147
148
308
                    to_scale = to_decimal_type->get_scale();
149
308
                    ToDataType::check_type_scale(to_scale);
150
308
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
308
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
308
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
308
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
308
                if (to_scale > from_scale) {
161
258
                    multiply_may_overflow &=
162
258
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
258
                }
164
308
                return narrow_integral || multiply_may_overflow;
165
308
            }
166
0
            return false;
167
308
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
114
417
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
417
            using Types2 = std::decay_t<decltype(types2)>;
116
417
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
417
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
417
                using FromFieldType = typename FromDataType::FieldType;
124
417
                using ToFieldType = typename ToDataType::FieldType;
125
417
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
417
                UInt32 from_scale = 0;
127
128
417
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
417
                    const auto* from_decimal_type =
130
417
                            check_and_get_data_type<FromDataType>(from_type.get());
131
417
                    from_precision =
132
417
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
417
                    from_scale = from_decimal_type->get_scale();
134
417
                }
135
136
417
                UInt32 to_max_digits = 0;
137
417
                UInt32 to_precision = 0;
138
417
                UInt32 to_scale = 0;
139
140
417
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
417
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
417
                    const auto* to_decimal_type =
144
417
                            check_and_get_data_type<ToDataType>(to_type.get());
145
417
                    to_precision = to_decimal_type->get_precision();
146
417
                    ToDataType::check_type_precision(to_precision);
147
148
417
                    to_scale = to_decimal_type->get_scale();
149
417
                    ToDataType::check_type_scale(to_scale);
150
417
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
417
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
417
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
417
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
417
                if (to_scale > from_scale) {
161
90
                    multiply_may_overflow &=
162
90
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
90
                }
164
417
                return narrow_integral || multiply_may_overflow;
165
417
            }
166
0
            return false;
167
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
114
508
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
508
            using Types2 = std::decay_t<decltype(types2)>;
116
508
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
508
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
508
                using FromFieldType = typename FromDataType::FieldType;
124
508
                using ToFieldType = typename ToDataType::FieldType;
125
508
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
508
                UInt32 from_scale = 0;
127
128
508
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
508
                    const auto* from_decimal_type =
130
508
                            check_and_get_data_type<FromDataType>(from_type.get());
131
508
                    from_precision =
132
508
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
508
                    from_scale = from_decimal_type->get_scale();
134
508
                }
135
136
508
                UInt32 to_max_digits = 0;
137
508
                UInt32 to_precision = 0;
138
508
                UInt32 to_scale = 0;
139
140
508
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
508
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
508
                    const auto* to_decimal_type =
144
508
                            check_and_get_data_type<ToDataType>(to_type.get());
145
508
                    to_precision = to_decimal_type->get_precision();
146
508
                    ToDataType::check_type_precision(to_precision);
147
148
508
                    to_scale = to_decimal_type->get_scale();
149
508
                    ToDataType::check_type_scale(to_scale);
150
508
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
508
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
508
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
508
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
508
                if (to_scale > from_scale) {
161
86
                    multiply_may_overflow &=
162
86
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
86
                }
164
508
                return narrow_integral || multiply_may_overflow;
165
508
            }
166
0
            return false;
167
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
114
206
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
206
            using Types2 = std::decay_t<decltype(types2)>;
116
206
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
206
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
206
                using FromFieldType = typename FromDataType::FieldType;
124
206
                using ToFieldType = typename ToDataType::FieldType;
125
206
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
206
                UInt32 from_scale = 0;
127
128
206
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
206
                    const auto* from_decimal_type =
130
206
                            check_and_get_data_type<FromDataType>(from_type.get());
131
206
                    from_precision =
132
206
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
206
                    from_scale = from_decimal_type->get_scale();
134
206
                }
135
136
206
                UInt32 to_max_digits = 0;
137
206
                UInt32 to_precision = 0;
138
206
                UInt32 to_scale = 0;
139
140
206
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
206
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
206
                    const auto* to_decimal_type =
144
206
                            check_and_get_data_type<ToDataType>(to_type.get());
145
206
                    to_precision = to_decimal_type->get_precision();
146
206
                    ToDataType::check_type_precision(to_precision);
147
148
206
                    to_scale = to_decimal_type->get_scale();
149
206
                    ToDataType::check_type_scale(to_scale);
150
206
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
206
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
206
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
206
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
206
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
206
                return narrow_integral || multiply_may_overflow;
165
206
            }
166
0
            return false;
167
206
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
114
317
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
317
            using Types2 = std::decay_t<decltype(types2)>;
116
317
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
317
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
317
                using FromFieldType = typename FromDataType::FieldType;
124
317
                using ToFieldType = typename ToDataType::FieldType;
125
317
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
317
                UInt32 from_scale = 0;
127
128
317
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
317
                    const auto* from_decimal_type =
130
317
                            check_and_get_data_type<FromDataType>(from_type.get());
131
317
                    from_precision =
132
317
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
317
                    from_scale = from_decimal_type->get_scale();
134
317
                }
135
136
317
                UInt32 to_max_digits = 0;
137
317
                UInt32 to_precision = 0;
138
317
                UInt32 to_scale = 0;
139
140
317
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
317
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
317
                    const auto* to_decimal_type =
144
317
                            check_and_get_data_type<ToDataType>(to_type.get());
145
317
                    to_precision = to_decimal_type->get_precision();
146
317
                    ToDataType::check_type_precision(to_precision);
147
148
317
                    to_scale = to_decimal_type->get_scale();
149
317
                    ToDataType::check_type_scale(to_scale);
150
317
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
317
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
317
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
317
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
317
                if (to_scale > from_scale) {
161
83
                    multiply_may_overflow &=
162
83
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
83
                }
164
317
                return narrow_integral || multiply_may_overflow;
165
317
            }
166
0
            return false;
167
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
114
303
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
303
            using Types2 = std::decay_t<decltype(types2)>;
116
303
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
303
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
303
                using FromFieldType = typename FromDataType::FieldType;
124
303
                using ToFieldType = typename ToDataType::FieldType;
125
303
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
303
                UInt32 from_scale = 0;
127
128
303
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
303
                    const auto* from_decimal_type =
130
303
                            check_and_get_data_type<FromDataType>(from_type.get());
131
303
                    from_precision =
132
303
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
303
                    from_scale = from_decimal_type->get_scale();
134
303
                }
135
136
303
                UInt32 to_max_digits = 0;
137
303
                UInt32 to_precision = 0;
138
303
                UInt32 to_scale = 0;
139
140
303
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
303
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
303
                    const auto* to_decimal_type =
144
303
                            check_and_get_data_type<ToDataType>(to_type.get());
145
303
                    to_precision = to_decimal_type->get_precision();
146
303
                    ToDataType::check_type_precision(to_precision);
147
148
303
                    to_scale = to_decimal_type->get_scale();
149
303
                    ToDataType::check_type_scale(to_scale);
150
303
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
303
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
303
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
303
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
303
                if (to_scale > from_scale) {
161
79
                    multiply_may_overflow &=
162
79
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
79
                }
164
303
                return narrow_integral || multiply_may_overflow;
165
303
            }
166
0
            return false;
167
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
114
2.50k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.50k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.50k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
2.50k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
2.50k
                return false;
121
2.50k
            }
122
2.50k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
2.50k
                using FromFieldType = typename FromDataType::FieldType;
124
2.50k
                using ToFieldType = typename ToDataType::FieldType;
125
2.50k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
2.50k
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
2.50k
                UInt32 to_max_digits = 0;
137
2.50k
                UInt32 to_precision = 0;
138
2.50k
                UInt32 to_scale = 0;
139
140
2.50k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
2.50k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
2.50k
                    const auto* to_decimal_type =
144
2.50k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
2.50k
                    to_precision = to_decimal_type->get_precision();
146
2.50k
                    ToDataType::check_type_precision(to_precision);
147
148
2.50k
                    to_scale = to_decimal_type->get_scale();
149
2.50k
                    ToDataType::check_type_scale(to_scale);
150
2.50k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
2.50k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
2.50k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
2.50k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
2.50k
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
2.50k
                return narrow_integral || multiply_may_overflow;
165
2.50k
            }
166
0
            return false;
167
2.50k
        });
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
114
17
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
17
            using Types2 = std::decay_t<decltype(types2)>;
116
17
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
17
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
17
                using FromFieldType = typename FromDataType::FieldType;
124
17
                using ToFieldType = typename ToDataType::FieldType;
125
17
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
17
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
17
                UInt32 to_max_digits = 0;
137
17
                UInt32 to_precision = 0;
138
17
                UInt32 to_scale = 0;
139
140
17
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
17
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
17
                    const auto* to_decimal_type =
144
17
                            check_and_get_data_type<ToDataType>(to_type.get());
145
17
                    to_precision = to_decimal_type->get_precision();
146
17
                    ToDataType::check_type_precision(to_precision);
147
148
17
                    to_scale = to_decimal_type->get_scale();
149
17
                    ToDataType::check_type_scale(to_scale);
150
17
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
17
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
17
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
17
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
17
                if (to_scale > from_scale) {
161
16
                    multiply_may_overflow &=
162
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
16
                }
164
17
                return narrow_integral || multiply_may_overflow;
165
17
            }
166
0
            return false;
167
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
114
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
72
            using Types2 = std::decay_t<decltype(types2)>;
116
72
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
72
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
72
                using FromFieldType = typename FromDataType::FieldType;
124
72
                using ToFieldType = typename ToDataType::FieldType;
125
72
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
72
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
72
                UInt32 to_max_digits = 0;
137
72
                UInt32 to_precision = 0;
138
72
                UInt32 to_scale = 0;
139
140
72
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
72
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
72
                    const auto* to_decimal_type =
144
72
                            check_and_get_data_type<ToDataType>(to_type.get());
145
72
                    to_precision = to_decimal_type->get_precision();
146
72
                    ToDataType::check_type_precision(to_precision);
147
148
72
                    to_scale = to_decimal_type->get_scale();
149
72
                    ToDataType::check_type_scale(to_scale);
150
72
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
72
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
72
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
72
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
72
                if (to_scale > from_scale) {
161
59
                    multiply_may_overflow &=
162
59
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
59
                }
164
72
                return narrow_integral || multiply_may_overflow;
165
72
            }
166
0
            return false;
167
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
114
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
49
            using Types2 = std::decay_t<decltype(types2)>;
116
49
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
49
                using FromFieldType = typename FromDataType::FieldType;
124
49
                using ToFieldType = typename ToDataType::FieldType;
125
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
49
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
49
                UInt32 to_max_digits = 0;
137
49
                UInt32 to_precision = 0;
138
49
                UInt32 to_scale = 0;
139
140
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
49
                    const auto* to_decimal_type =
144
49
                            check_and_get_data_type<ToDataType>(to_type.get());
145
49
                    to_precision = to_decimal_type->get_precision();
146
49
                    ToDataType::check_type_precision(to_precision);
147
148
49
                    to_scale = to_decimal_type->get_scale();
149
49
                    ToDataType::check_type_scale(to_scale);
150
49
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
49
                if (to_scale > from_scale) {
161
38
                    multiply_may_overflow &=
162
38
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
38
                }
164
49
                return narrow_integral || multiply_may_overflow;
165
49
            }
166
0
            return false;
167
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
114
505
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
505
            using Types2 = std::decay_t<decltype(types2)>;
116
505
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
505
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
505
                using FromFieldType = typename FromDataType::FieldType;
124
505
                using ToFieldType = typename ToDataType::FieldType;
125
505
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
505
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
505
                UInt32 to_max_digits = 0;
137
505
                UInt32 to_precision = 0;
138
505
                UInt32 to_scale = 0;
139
140
505
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
505
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
505
                    const auto* to_decimal_type =
144
505
                            check_and_get_data_type<ToDataType>(to_type.get());
145
505
                    to_precision = to_decimal_type->get_precision();
146
505
                    ToDataType::check_type_precision(to_precision);
147
148
505
                    to_scale = to_decimal_type->get_scale();
149
505
                    ToDataType::check_type_scale(to_scale);
150
505
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
505
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
505
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
505
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
505
                if (to_scale > from_scale) {
161
348
                    multiply_may_overflow &=
162
348
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
348
                }
164
505
                return narrow_integral || multiply_may_overflow;
165
505
            }
166
0
            return false;
167
505
        });
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
114
52
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
52
            using Types2 = std::decay_t<decltype(types2)>;
116
52
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
52
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
52
                using FromFieldType = typename FromDataType::FieldType;
124
52
                using ToFieldType = typename ToDataType::FieldType;
125
52
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
52
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
52
                UInt32 to_max_digits = 0;
137
52
                UInt32 to_precision = 0;
138
52
                UInt32 to_scale = 0;
139
140
52
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
52
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
52
                    const auto* to_decimal_type =
144
52
                            check_and_get_data_type<ToDataType>(to_type.get());
145
52
                    to_precision = to_decimal_type->get_precision();
146
52
                    ToDataType::check_type_precision(to_precision);
147
148
52
                    to_scale = to_decimal_type->get_scale();
149
52
                    ToDataType::check_type_scale(to_scale);
150
52
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
52
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
52
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
52
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
52
                if (to_scale > from_scale) {
161
31
                    multiply_may_overflow &=
162
31
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
31
                }
164
52
                return narrow_integral || multiply_may_overflow;
165
52
            }
166
0
            return false;
167
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
114
65
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
65
            using Types2 = std::decay_t<decltype(types2)>;
116
65
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
65
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
65
                using FromFieldType = typename FromDataType::FieldType;
124
65
                using ToFieldType = typename ToDataType::FieldType;
125
65
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
65
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
65
                UInt32 to_max_digits = 0;
137
65
                UInt32 to_precision = 0;
138
65
                UInt32 to_scale = 0;
139
140
65
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
65
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
65
                    const auto* to_decimal_type =
144
65
                            check_and_get_data_type<ToDataType>(to_type.get());
145
65
                    to_precision = to_decimal_type->get_precision();
146
65
                    ToDataType::check_type_precision(to_precision);
147
148
65
                    to_scale = to_decimal_type->get_scale();
149
65
                    ToDataType::check_type_scale(to_scale);
150
65
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
65
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
65
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
65
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
65
                if (to_scale > from_scale) {
161
39
                    multiply_may_overflow &=
162
39
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
39
                }
164
65
                return narrow_integral || multiply_may_overflow;
165
65
            }
166
0
            return false;
167
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
114
107
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
107
            using Types2 = std::decay_t<decltype(types2)>;
116
107
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
107
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
107
                using FromFieldType = typename FromDataType::FieldType;
124
107
                using ToFieldType = typename ToDataType::FieldType;
125
107
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
107
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
107
                UInt32 to_max_digits = 0;
137
107
                UInt32 to_precision = 0;
138
107
                UInt32 to_scale = 0;
139
140
107
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
107
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
107
                    const auto* to_decimal_type =
144
107
                            check_and_get_data_type<ToDataType>(to_type.get());
145
107
                    to_precision = to_decimal_type->get_precision();
146
107
                    ToDataType::check_type_precision(to_precision);
147
148
107
                    to_scale = to_decimal_type->get_scale();
149
107
                    ToDataType::check_type_scale(to_scale);
150
107
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
107
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
107
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
107
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
107
                if (to_scale > from_scale) {
161
65
                    multiply_may_overflow &=
162
65
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
65
                }
164
107
                return narrow_integral || multiply_may_overflow;
165
107
            }
166
0
            return false;
167
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
114
210
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
210
            using Types2 = std::decay_t<decltype(types2)>;
116
210
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
210
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
210
                using FromFieldType = typename FromDataType::FieldType;
124
210
                using ToFieldType = typename ToDataType::FieldType;
125
210
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
210
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
210
                UInt32 to_max_digits = 0;
137
210
                UInt32 to_precision = 0;
138
210
                UInt32 to_scale = 0;
139
140
210
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
210
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
210
                    const auto* to_decimal_type =
144
210
                            check_and_get_data_type<ToDataType>(to_type.get());
145
210
                    to_precision = to_decimal_type->get_precision();
146
210
                    ToDataType::check_type_precision(to_precision);
147
148
210
                    to_scale = to_decimal_type->get_scale();
149
210
                    ToDataType::check_type_scale(to_scale);
150
210
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
210
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
210
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
210
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
210
                if (to_scale > from_scale) {
161
177
                    multiply_may_overflow &=
162
177
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
177
                }
164
210
                return narrow_integral || multiply_may_overflow;
165
210
            }
166
0
            return false;
167
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
114
1.11k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.11k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.11k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
1.11k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1.11k
                using FromFieldType = typename FromDataType::FieldType;
124
1.11k
                using ToFieldType = typename ToDataType::FieldType;
125
1.11k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1.11k
                UInt32 from_scale = 0;
127
128
1.11k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
1.11k
                    const auto* from_decimal_type =
130
1.11k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
1.11k
                    from_precision =
132
1.11k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
1.11k
                    from_scale = from_decimal_type->get_scale();
134
1.11k
                }
135
136
1.11k
                UInt32 to_max_digits = 0;
137
1.11k
                UInt32 to_precision = 0;
138
1.11k
                UInt32 to_scale = 0;
139
140
1.11k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1.11k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1.11k
                    const auto* to_decimal_type =
144
1.11k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1.11k
                    to_precision = to_decimal_type->get_precision();
146
1.11k
                    ToDataType::check_type_precision(to_precision);
147
148
1.11k
                    to_scale = to_decimal_type->get_scale();
149
1.11k
                    ToDataType::check_type_scale(to_scale);
150
1.11k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
1.11k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1.11k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1.11k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1.11k
                if (to_scale > from_scale) {
161
770
                    multiply_may_overflow &=
162
770
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
770
                }
164
1.11k
                return narrow_integral || multiply_may_overflow;
165
1.11k
            }
166
0
            return false;
167
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
114
872
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
872
            using Types2 = std::decay_t<decltype(types2)>;
116
872
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
872
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
872
                using FromFieldType = typename FromDataType::FieldType;
124
872
                using ToFieldType = typename ToDataType::FieldType;
125
872
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
872
                UInt32 from_scale = 0;
127
128
872
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
872
                    const auto* from_decimal_type =
130
872
                            check_and_get_data_type<FromDataType>(from_type.get());
131
872
                    from_precision =
132
872
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
872
                    from_scale = from_decimal_type->get_scale();
134
872
                }
135
136
872
                UInt32 to_max_digits = 0;
137
872
                UInt32 to_precision = 0;
138
872
                UInt32 to_scale = 0;
139
140
872
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
872
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
872
                    const auto* to_decimal_type =
144
872
                            check_and_get_data_type<ToDataType>(to_type.get());
145
872
                    to_precision = to_decimal_type->get_precision();
146
872
                    ToDataType::check_type_precision(to_precision);
147
148
872
                    to_scale = to_decimal_type->get_scale();
149
872
                    ToDataType::check_type_scale(to_scale);
150
872
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
872
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
872
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
872
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
872
                if (to_scale > from_scale) {
161
157
                    multiply_may_overflow &=
162
157
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
157
                }
164
872
                return narrow_integral || multiply_may_overflow;
165
872
            }
166
0
            return false;
167
872
        });
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
114
216
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
216
            using Types2 = std::decay_t<decltype(types2)>;
116
216
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
216
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
216
                using FromFieldType = typename FromDataType::FieldType;
124
216
                using ToFieldType = typename ToDataType::FieldType;
125
216
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
216
                UInt32 from_scale = 0;
127
128
216
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
216
                    const auto* from_decimal_type =
130
216
                            check_and_get_data_type<FromDataType>(from_type.get());
131
216
                    from_precision =
132
216
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
216
                    from_scale = from_decimal_type->get_scale();
134
216
                }
135
136
216
                UInt32 to_max_digits = 0;
137
216
                UInt32 to_precision = 0;
138
216
                UInt32 to_scale = 0;
139
140
216
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
216
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
216
                    const auto* to_decimal_type =
144
216
                            check_and_get_data_type<ToDataType>(to_type.get());
145
216
                    to_precision = to_decimal_type->get_precision();
146
216
                    ToDataType::check_type_precision(to_precision);
147
148
216
                    to_scale = to_decimal_type->get_scale();
149
216
                    ToDataType::check_type_scale(to_scale);
150
216
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
216
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
216
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
216
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
216
                if (to_scale > from_scale) {
161
50
                    multiply_may_overflow &=
162
50
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
50
                }
164
216
                return narrow_integral || multiply_may_overflow;
165
216
            }
166
0
            return false;
167
216
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
114
421
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
421
            using Types2 = std::decay_t<decltype(types2)>;
116
421
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
421
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
421
                using FromFieldType = typename FromDataType::FieldType;
124
421
                using ToFieldType = typename ToDataType::FieldType;
125
421
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
421
                UInt32 from_scale = 0;
127
128
421
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
421
                    const auto* from_decimal_type =
130
421
                            check_and_get_data_type<FromDataType>(from_type.get());
131
421
                    from_precision =
132
421
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
421
                    from_scale = from_decimal_type->get_scale();
134
421
                }
135
136
421
                UInt32 to_max_digits = 0;
137
421
                UInt32 to_precision = 0;
138
421
                UInt32 to_scale = 0;
139
140
421
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
421
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
421
                    const auto* to_decimal_type =
144
421
                            check_and_get_data_type<ToDataType>(to_type.get());
145
421
                    to_precision = to_decimal_type->get_precision();
146
421
                    ToDataType::check_type_precision(to_precision);
147
148
421
                    to_scale = to_decimal_type->get_scale();
149
421
                    ToDataType::check_type_scale(to_scale);
150
421
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
421
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
421
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
421
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
421
                if (to_scale > from_scale) {
161
144
                    multiply_may_overflow &=
162
144
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
144
                }
164
421
                return narrow_integral || multiply_may_overflow;
165
421
            }
166
0
            return false;
167
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
114
401
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
401
            using Types2 = std::decay_t<decltype(types2)>;
116
401
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
401
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
401
                using FromFieldType = typename FromDataType::FieldType;
124
401
                using ToFieldType = typename ToDataType::FieldType;
125
401
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
401
                UInt32 from_scale = 0;
127
128
401
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
401
                    const auto* from_decimal_type =
130
401
                            check_and_get_data_type<FromDataType>(from_type.get());
131
401
                    from_precision =
132
401
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
401
                    from_scale = from_decimal_type->get_scale();
134
401
                }
135
136
401
                UInt32 to_max_digits = 0;
137
401
                UInt32 to_precision = 0;
138
401
                UInt32 to_scale = 0;
139
140
401
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
401
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
401
                    const auto* to_decimal_type =
144
401
                            check_and_get_data_type<ToDataType>(to_type.get());
145
401
                    to_precision = to_decimal_type->get_precision();
146
401
                    ToDataType::check_type_precision(to_precision);
147
148
401
                    to_scale = to_decimal_type->get_scale();
149
401
                    ToDataType::check_type_scale(to_scale);
150
401
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
401
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
401
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
401
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
401
                if (to_scale > from_scale) {
161
137
                    multiply_may_overflow &=
162
137
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
137
                }
164
401
                return narrow_integral || multiply_may_overflow;
165
401
            }
166
0
            return false;
167
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
114
6.59k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
6.59k
            using Types2 = std::decay_t<decltype(types2)>;
116
6.59k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
6.59k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
6.59k
                return false;
121
6.59k
            }
122
6.59k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
6.59k
                using FromFieldType = typename FromDataType::FieldType;
124
6.59k
                using ToFieldType = typename ToDataType::FieldType;
125
6.59k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
6.59k
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
6.59k
                UInt32 to_max_digits = 0;
137
6.59k
                UInt32 to_precision = 0;
138
6.59k
                UInt32 to_scale = 0;
139
140
6.59k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
6.59k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
6.59k
                    const auto* to_decimal_type =
144
6.59k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
6.59k
                    to_precision = to_decimal_type->get_precision();
146
6.59k
                    ToDataType::check_type_precision(to_precision);
147
148
6.59k
                    to_scale = to_decimal_type->get_scale();
149
6.59k
                    ToDataType::check_type_scale(to_scale);
150
6.59k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
6.59k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
6.59k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
6.59k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
6.59k
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
6.59k
                return narrow_integral || multiply_may_overflow;
165
6.59k
            }
166
0
            return false;
167
6.59k
        });
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
114
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
20
            using Types2 = std::decay_t<decltype(types2)>;
116
20
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
20
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
20
                using FromFieldType = typename FromDataType::FieldType;
124
20
                using ToFieldType = typename ToDataType::FieldType;
125
20
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
20
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
20
                UInt32 to_max_digits = 0;
137
20
                UInt32 to_precision = 0;
138
20
                UInt32 to_scale = 0;
139
140
20
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
20
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
20
                    const auto* to_decimal_type =
144
20
                            check_and_get_data_type<ToDataType>(to_type.get());
145
20
                    to_precision = to_decimal_type->get_precision();
146
20
                    ToDataType::check_type_precision(to_precision);
147
148
20
                    to_scale = to_decimal_type->get_scale();
149
20
                    ToDataType::check_type_scale(to_scale);
150
20
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
20
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
20
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
20
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
20
                if (to_scale > from_scale) {
161
20
                    multiply_may_overflow &=
162
20
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
20
                }
164
20
                return narrow_integral || multiply_may_overflow;
165
20
            }
166
0
            return false;
167
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
114
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
16
            using Types2 = std::decay_t<decltype(types2)>;
116
16
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
16
                using FromFieldType = typename FromDataType::FieldType;
124
16
                using ToFieldType = typename ToDataType::FieldType;
125
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
16
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
16
                UInt32 to_max_digits = 0;
137
16
                UInt32 to_precision = 0;
138
16
                UInt32 to_scale = 0;
139
140
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
16
                    const auto* to_decimal_type =
144
16
                            check_and_get_data_type<ToDataType>(to_type.get());
145
16
                    to_precision = to_decimal_type->get_precision();
146
16
                    ToDataType::check_type_precision(to_precision);
147
148
16
                    to_scale = to_decimal_type->get_scale();
149
16
                    ToDataType::check_type_scale(to_scale);
150
16
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
16
                if (to_scale > from_scale) {
161
16
                    multiply_may_overflow &=
162
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
16
                }
164
16
                return narrow_integral || multiply_may_overflow;
165
16
            }
166
0
            return false;
167
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
114
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
16
            using Types2 = std::decay_t<decltype(types2)>;
116
16
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
16
                using FromFieldType = typename FromDataType::FieldType;
124
16
                using ToFieldType = typename ToDataType::FieldType;
125
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
16
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
16
                UInt32 to_max_digits = 0;
137
16
                UInt32 to_precision = 0;
138
16
                UInt32 to_scale = 0;
139
140
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
16
                    const auto* to_decimal_type =
144
16
                            check_and_get_data_type<ToDataType>(to_type.get());
145
16
                    to_precision = to_decimal_type->get_precision();
146
16
                    ToDataType::check_type_precision(to_precision);
147
148
16
                    to_scale = to_decimal_type->get_scale();
149
16
                    ToDataType::check_type_scale(to_scale);
150
16
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
16
                if (to_scale > from_scale) {
161
16
                    multiply_may_overflow &=
162
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
16
                }
164
16
                return narrow_integral || multiply_may_overflow;
165
16
            }
166
0
            return false;
167
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
114
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
16
            using Types2 = std::decay_t<decltype(types2)>;
116
16
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
16
                using FromFieldType = typename FromDataType::FieldType;
124
16
                using ToFieldType = typename ToDataType::FieldType;
125
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
16
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
16
                UInt32 to_max_digits = 0;
137
16
                UInt32 to_precision = 0;
138
16
                UInt32 to_scale = 0;
139
140
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
16
                    const auto* to_decimal_type =
144
16
                            check_and_get_data_type<ToDataType>(to_type.get());
145
16
                    to_precision = to_decimal_type->get_precision();
146
16
                    ToDataType::check_type_precision(to_precision);
147
148
16
                    to_scale = to_decimal_type->get_scale();
149
16
                    ToDataType::check_type_scale(to_scale);
150
16
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
16
                if (to_scale > from_scale) {
161
16
                    multiply_may_overflow &=
162
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
16
                }
164
16
                return narrow_integral || multiply_may_overflow;
165
16
            }
166
0
            return false;
167
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
114
32
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
32
            using Types2 = std::decay_t<decltype(types2)>;
116
32
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
32
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
32
                using FromFieldType = typename FromDataType::FieldType;
124
32
                using ToFieldType = typename ToDataType::FieldType;
125
32
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
32
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
32
                UInt32 to_max_digits = 0;
137
32
                UInt32 to_precision = 0;
138
32
                UInt32 to_scale = 0;
139
140
32
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
32
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
32
                    const auto* to_decimal_type =
144
32
                            check_and_get_data_type<ToDataType>(to_type.get());
145
32
                    to_precision = to_decimal_type->get_precision();
146
32
                    ToDataType::check_type_precision(to_precision);
147
148
32
                    to_scale = to_decimal_type->get_scale();
149
32
                    ToDataType::check_type_scale(to_scale);
150
32
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
32
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
32
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
32
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
32
                if (to_scale > from_scale) {
161
32
                    multiply_may_overflow &=
162
32
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
32
                }
164
32
                return narrow_integral || multiply_may_overflow;
165
32
            }
166
0
            return false;
167
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
114
128
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
128
            using Types2 = std::decay_t<decltype(types2)>;
116
128
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
128
                using FromFieldType = typename FromDataType::FieldType;
124
128
                using ToFieldType = typename ToDataType::FieldType;
125
128
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
128
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
128
                UInt32 to_max_digits = 0;
137
128
                UInt32 to_precision = 0;
138
128
                UInt32 to_scale = 0;
139
140
128
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
128
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
128
                    const auto* to_decimal_type =
144
128
                            check_and_get_data_type<ToDataType>(to_type.get());
145
128
                    to_precision = to_decimal_type->get_precision();
146
128
                    ToDataType::check_type_precision(to_precision);
147
148
128
                    to_scale = to_decimal_type->get_scale();
149
128
                    ToDataType::check_type_scale(to_scale);
150
128
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
128
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
128
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
128
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
128
                if (to_scale > from_scale) {
161
128
                    multiply_may_overflow &=
162
128
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
128
                }
164
128
                return narrow_integral || multiply_may_overflow;
165
128
            }
166
0
            return false;
167
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
114
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1
            using Types2 = std::decay_t<decltype(types2)>;
116
1
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
1
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1
                return false;
121
1
            }
122
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1
                using FromFieldType = typename FromDataType::FieldType;
124
1
                using ToFieldType = typename ToDataType::FieldType;
125
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
1
                UInt32 to_max_digits = 0;
137
1
                UInt32 to_precision = 0;
138
1
                UInt32 to_scale = 0;
139
140
1
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1
                    const auto* to_decimal_type =
144
1
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1
                    to_precision = to_decimal_type->get_precision();
146
1
                    ToDataType::check_type_precision(to_precision);
147
148
1
                    to_scale = to_decimal_type->get_scale();
149
1
                    ToDataType::check_type_scale(to_scale);
150
1
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
1
                return narrow_integral || multiply_may_overflow;
165
1
            }
166
0
            return false;
167
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
114
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
23
            using Types2 = std::decay_t<decltype(types2)>;
116
23
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
23
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
23
                using FromFieldType = typename FromDataType::FieldType;
124
23
                using ToFieldType = typename ToDataType::FieldType;
125
23
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
23
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
23
                UInt32 to_max_digits = 0;
137
23
                UInt32 to_precision = 0;
138
23
                UInt32 to_scale = 0;
139
140
23
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
23
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
23
                    const auto* to_decimal_type =
144
23
                            check_and_get_data_type<ToDataType>(to_type.get());
145
23
                    to_precision = to_decimal_type->get_precision();
146
23
                    ToDataType::check_type_precision(to_precision);
147
148
23
                    to_scale = to_decimal_type->get_scale();
149
23
                    ToDataType::check_type_scale(to_scale);
150
23
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
23
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
23
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
23
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
23
                if (to_scale > from_scale) {
161
22
                    multiply_may_overflow &=
162
22
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
22
                }
164
23
                return narrow_integral || multiply_may_overflow;
165
23
            }
166
0
            return false;
167
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
114
125
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
125
            using Types2 = std::decay_t<decltype(types2)>;
116
125
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
125
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
125
                using FromFieldType = typename FromDataType::FieldType;
124
125
                using ToFieldType = typename ToDataType::FieldType;
125
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
125
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
125
                UInt32 to_max_digits = 0;
137
125
                UInt32 to_precision = 0;
138
125
                UInt32 to_scale = 0;
139
140
125
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
125
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
125
                    const auto* to_decimal_type =
144
125
                            check_and_get_data_type<ToDataType>(to_type.get());
145
125
                    to_precision = to_decimal_type->get_precision();
146
125
                    ToDataType::check_type_precision(to_precision);
147
148
125
                    to_scale = to_decimal_type->get_scale();
149
125
                    ToDataType::check_type_scale(to_scale);
150
125
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
125
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
125
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
125
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
125
                if (to_scale > from_scale) {
161
92
                    multiply_may_overflow &=
162
92
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
92
                }
164
125
                return narrow_integral || multiply_may_overflow;
165
125
            }
166
0
            return false;
167
125
        });
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
114
112
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
112
            using Types2 = std::decay_t<decltype(types2)>;
116
112
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
112
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
112
                using FromFieldType = typename FromDataType::FieldType;
124
112
                using ToFieldType = typename ToDataType::FieldType;
125
112
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
112
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
112
                UInt32 to_max_digits = 0;
137
112
                UInt32 to_precision = 0;
138
112
                UInt32 to_scale = 0;
139
140
112
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
112
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
112
                    const auto* to_decimal_type =
144
112
                            check_and_get_data_type<ToDataType>(to_type.get());
145
112
                    to_precision = to_decimal_type->get_precision();
146
112
                    ToDataType::check_type_precision(to_precision);
147
148
112
                    to_scale = to_decimal_type->get_scale();
149
112
                    ToDataType::check_type_scale(to_scale);
150
112
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
112
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
112
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
112
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
112
                if (to_scale > from_scale) {
161
79
                    multiply_may_overflow &=
162
79
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
79
                }
164
112
                return narrow_integral || multiply_may_overflow;
165
112
            }
166
0
            return false;
167
112
        });
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
114
375
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
375
            using Types2 = std::decay_t<decltype(types2)>;
116
375
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
375
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
375
                using FromFieldType = typename FromDataType::FieldType;
124
375
                using ToFieldType = typename ToDataType::FieldType;
125
375
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
375
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
375
                UInt32 to_max_digits = 0;
137
375
                UInt32 to_precision = 0;
138
375
                UInt32 to_scale = 0;
139
140
375
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
375
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
375
                    const auto* to_decimal_type =
144
375
                            check_and_get_data_type<ToDataType>(to_type.get());
145
375
                    to_precision = to_decimal_type->get_precision();
146
375
                    ToDataType::check_type_precision(to_precision);
147
148
375
                    to_scale = to_decimal_type->get_scale();
149
375
                    ToDataType::check_type_scale(to_scale);
150
375
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
375
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
375
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
375
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
375
                if (to_scale > from_scale) {
161
337
                    multiply_may_overflow &=
162
337
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
337
                }
164
375
                return narrow_integral || multiply_may_overflow;
165
375
            }
166
0
            return false;
167
375
        });
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
114
974
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
974
            using Types2 = std::decay_t<decltype(types2)>;
116
974
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
974
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
974
                using FromFieldType = typename FromDataType::FieldType;
124
974
                using ToFieldType = typename ToDataType::FieldType;
125
974
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
974
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
974
                UInt32 to_max_digits = 0;
137
974
                UInt32 to_precision = 0;
138
974
                UInt32 to_scale = 0;
139
140
974
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
974
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
974
                    const auto* to_decimal_type =
144
974
                            check_and_get_data_type<ToDataType>(to_type.get());
145
974
                    to_precision = to_decimal_type->get_precision();
146
974
                    ToDataType::check_type_precision(to_precision);
147
148
974
                    to_scale = to_decimal_type->get_scale();
149
974
                    ToDataType::check_type_scale(to_scale);
150
974
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
974
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
974
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
974
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
974
                if (to_scale > from_scale) {
161
394
                    multiply_may_overflow &=
162
394
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
394
                }
164
974
                return narrow_integral || multiply_may_overflow;
165
974
            }
166
0
            return false;
167
974
        });
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
114
289
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
289
            using Types2 = std::decay_t<decltype(types2)>;
116
289
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
289
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
289
                using FromFieldType = typename FromDataType::FieldType;
124
289
                using ToFieldType = typename ToDataType::FieldType;
125
289
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
289
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
289
                UInt32 to_max_digits = 0;
137
289
                UInt32 to_precision = 0;
138
289
                UInt32 to_scale = 0;
139
140
289
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
289
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
289
                    const auto* to_decimal_type =
144
289
                            check_and_get_data_type<ToDataType>(to_type.get());
145
289
                    to_precision = to_decimal_type->get_precision();
146
289
                    ToDataType::check_type_precision(to_precision);
147
148
289
                    to_scale = to_decimal_type->get_scale();
149
289
                    ToDataType::check_type_scale(to_scale);
150
289
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
289
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
289
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
289
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
289
                if (to_scale > from_scale) {
161
148
                    multiply_may_overflow &=
162
148
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
148
                }
164
289
                return narrow_integral || multiply_may_overflow;
165
289
            }
166
0
            return false;
167
289
        });
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
114
206
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
206
            using Types2 = std::decay_t<decltype(types2)>;
116
206
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
206
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
206
                using FromFieldType = typename FromDataType::FieldType;
124
206
                using ToFieldType = typename ToDataType::FieldType;
125
206
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
206
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
206
                UInt32 to_max_digits = 0;
137
206
                UInt32 to_precision = 0;
138
206
                UInt32 to_scale = 0;
139
140
206
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
206
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
206
                    const auto* to_decimal_type =
144
206
                            check_and_get_data_type<ToDataType>(to_type.get());
145
206
                    to_precision = to_decimal_type->get_precision();
146
206
                    ToDataType::check_type_precision(to_precision);
147
148
206
                    to_scale = to_decimal_type->get_scale();
149
206
                    ToDataType::check_type_scale(to_scale);
150
206
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
206
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
206
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
206
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
206
                if (to_scale > from_scale) {
161
118
                    multiply_may_overflow &=
162
118
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
118
                }
164
206
                return narrow_integral || multiply_may_overflow;
165
206
            }
166
0
            return false;
167
206
        });
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
114
447
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
447
            using Types2 = std::decay_t<decltype(types2)>;
116
447
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
447
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
447
                using FromFieldType = typename FromDataType::FieldType;
124
447
                using ToFieldType = typename ToDataType::FieldType;
125
447
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
447
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
447
                UInt32 to_max_digits = 0;
137
447
                UInt32 to_precision = 0;
138
447
                UInt32 to_scale = 0;
139
140
447
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
447
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
447
                    const auto* to_decimal_type =
144
447
                            check_and_get_data_type<ToDataType>(to_type.get());
145
447
                    to_precision = to_decimal_type->get_precision();
146
447
                    ToDataType::check_type_precision(to_precision);
147
148
447
                    to_scale = to_decimal_type->get_scale();
149
447
                    ToDataType::check_type_scale(to_scale);
150
447
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
447
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
447
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
447
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
447
                if (to_scale > from_scale) {
161
367
                    multiply_may_overflow &=
162
367
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
367
                }
164
447
                return narrow_integral || multiply_may_overflow;
165
447
            }
166
0
            return false;
167
447
        });
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
114
622
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
622
            using Types2 = std::decay_t<decltype(types2)>;
116
622
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
622
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
622
                using FromFieldType = typename FromDataType::FieldType;
124
622
                using ToFieldType = typename ToDataType::FieldType;
125
622
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
622
                UInt32 from_scale = 0;
127
128
622
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
622
                    const auto* from_decimal_type =
130
622
                            check_and_get_data_type<FromDataType>(from_type.get());
131
622
                    from_precision =
132
622
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
622
                    from_scale = from_decimal_type->get_scale();
134
622
                }
135
136
622
                UInt32 to_max_digits = 0;
137
622
                UInt32 to_precision = 0;
138
622
                UInt32 to_scale = 0;
139
140
622
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
622
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
622
                    const auto* to_decimal_type =
144
622
                            check_and_get_data_type<ToDataType>(to_type.get());
145
622
                    to_precision = to_decimal_type->get_precision();
146
622
                    ToDataType::check_type_precision(to_precision);
147
148
622
                    to_scale = to_decimal_type->get_scale();
149
622
                    ToDataType::check_type_scale(to_scale);
150
622
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
622
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
622
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
622
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
622
                if (to_scale > from_scale) {
161
469
                    multiply_may_overflow &=
162
469
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
469
                }
164
622
                return narrow_integral || multiply_may_overflow;
165
622
            }
166
0
            return false;
167
622
        });
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
114
807
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
807
            using Types2 = std::decay_t<decltype(types2)>;
116
807
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
807
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
807
                using FromFieldType = typename FromDataType::FieldType;
124
807
                using ToFieldType = typename ToDataType::FieldType;
125
807
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
807
                UInt32 from_scale = 0;
127
128
807
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
807
                    const auto* from_decimal_type =
130
807
                            check_and_get_data_type<FromDataType>(from_type.get());
131
807
                    from_precision =
132
807
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
807
                    from_scale = from_decimal_type->get_scale();
134
807
                }
135
136
807
                UInt32 to_max_digits = 0;
137
807
                UInt32 to_precision = 0;
138
807
                UInt32 to_scale = 0;
139
140
807
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
807
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
807
                    const auto* to_decimal_type =
144
807
                            check_and_get_data_type<ToDataType>(to_type.get());
145
807
                    to_precision = to_decimal_type->get_precision();
146
807
                    ToDataType::check_type_precision(to_precision);
147
148
807
                    to_scale = to_decimal_type->get_scale();
149
807
                    ToDataType::check_type_scale(to_scale);
150
807
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
807
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
807
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
807
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
807
                if (to_scale > from_scale) {
161
470
                    multiply_may_overflow &=
162
470
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
470
                }
164
807
                return narrow_integral || multiply_may_overflow;
165
807
            }
166
0
            return false;
167
807
        });
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
114
257
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
257
            using Types2 = std::decay_t<decltype(types2)>;
116
257
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
257
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
257
                using FromFieldType = typename FromDataType::FieldType;
124
257
                using ToFieldType = typename ToDataType::FieldType;
125
257
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
257
                UInt32 from_scale = 0;
127
128
257
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
257
                    const auto* from_decimal_type =
130
257
                            check_and_get_data_type<FromDataType>(from_type.get());
131
257
                    from_precision =
132
257
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
257
                    from_scale = from_decimal_type->get_scale();
134
257
                }
135
136
257
                UInt32 to_max_digits = 0;
137
257
                UInt32 to_precision = 0;
138
257
                UInt32 to_scale = 0;
139
140
257
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
257
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
257
                    const auto* to_decimal_type =
144
257
                            check_and_get_data_type<ToDataType>(to_type.get());
145
257
                    to_precision = to_decimal_type->get_precision();
146
257
                    ToDataType::check_type_precision(to_precision);
147
148
257
                    to_scale = to_decimal_type->get_scale();
149
257
                    ToDataType::check_type_scale(to_scale);
150
257
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
257
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
257
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
257
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
257
                if (to_scale > from_scale) {
161
71
                    multiply_may_overflow &=
162
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
71
                }
164
257
                return narrow_integral || multiply_may_overflow;
165
257
            }
166
0
            return false;
167
257
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
114
1.18k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.18k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.18k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
1.18k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1.18k
                using FromFieldType = typename FromDataType::FieldType;
124
1.18k
                using ToFieldType = typename ToDataType::FieldType;
125
1.18k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1.18k
                UInt32 from_scale = 0;
127
128
1.18k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
1.18k
                    const auto* from_decimal_type =
130
1.18k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
1.18k
                    from_precision =
132
1.18k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
1.18k
                    from_scale = from_decimal_type->get_scale();
134
1.18k
                }
135
136
1.18k
                UInt32 to_max_digits = 0;
137
1.18k
                UInt32 to_precision = 0;
138
1.18k
                UInt32 to_scale = 0;
139
140
1.18k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1.18k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1.18k
                    const auto* to_decimal_type =
144
1.18k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1.18k
                    to_precision = to_decimal_type->get_precision();
146
1.18k
                    ToDataType::check_type_precision(to_precision);
147
148
1.18k
                    to_scale = to_decimal_type->get_scale();
149
1.18k
                    ToDataType::check_type_scale(to_scale);
150
1.18k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
1.18k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1.18k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1.18k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1.18k
                if (to_scale > from_scale) {
161
583
                    multiply_may_overflow &=
162
583
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
583
                }
164
1.18k
                return narrow_integral || multiply_may_overflow;
165
1.18k
            }
166
0
            return false;
167
1.18k
        });
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
114
700
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
700
            using Types2 = std::decay_t<decltype(types2)>;
116
700
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
700
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
700
                using FromFieldType = typename FromDataType::FieldType;
124
700
                using ToFieldType = typename ToDataType::FieldType;
125
700
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
700
                UInt32 from_scale = 0;
127
128
700
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
700
                    const auto* from_decimal_type =
130
700
                            check_and_get_data_type<FromDataType>(from_type.get());
131
700
                    from_precision =
132
700
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
700
                    from_scale = from_decimal_type->get_scale();
134
700
                }
135
136
700
                UInt32 to_max_digits = 0;
137
700
                UInt32 to_precision = 0;
138
700
                UInt32 to_scale = 0;
139
140
700
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
700
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
700
                    const auto* to_decimal_type =
144
700
                            check_and_get_data_type<ToDataType>(to_type.get());
145
700
                    to_precision = to_decimal_type->get_precision();
146
700
                    ToDataType::check_type_precision(to_precision);
147
148
700
                    to_scale = to_decimal_type->get_scale();
149
700
                    ToDataType::check_type_scale(to_scale);
150
700
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
700
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
700
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
700
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
700
                if (to_scale > from_scale) {
161
274
                    multiply_may_overflow &=
162
274
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
274
                }
164
700
                return narrow_integral || multiply_may_overflow;
165
700
            }
166
0
            return false;
167
700
        });
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
114
3.85k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3.85k
            using Types2 = std::decay_t<decltype(types2)>;
116
3.85k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
3.85k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
3.85k
                return false;
121
3.85k
            }
122
3.85k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
3.85k
                using FromFieldType = typename FromDataType::FieldType;
124
3.85k
                using ToFieldType = typename ToDataType::FieldType;
125
3.85k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
3.85k
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
3.85k
                UInt32 to_max_digits = 0;
137
3.85k
                UInt32 to_precision = 0;
138
3.85k
                UInt32 to_scale = 0;
139
140
3.85k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
3.85k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
3.85k
                    const auto* to_decimal_type =
144
3.85k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
3.85k
                    to_precision = to_decimal_type->get_precision();
146
3.85k
                    ToDataType::check_type_precision(to_precision);
147
148
3.85k
                    to_scale = to_decimal_type->get_scale();
149
3.85k
                    ToDataType::check_type_scale(to_scale);
150
3.85k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
3.85k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
3.85k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
3.85k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
3.85k
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
3.85k
                return narrow_integral || multiply_may_overflow;
165
3.85k
            }
166
0
            return false;
167
3.85k
        });
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
114
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7
            using Types2 = std::decay_t<decltype(types2)>;
116
7
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
7
                using FromFieldType = typename FromDataType::FieldType;
124
7
                using ToFieldType = typename ToDataType::FieldType;
125
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
7
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
7
                UInt32 to_max_digits = 0;
137
7
                UInt32 to_precision = 0;
138
7
                UInt32 to_scale = 0;
139
140
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
7
                    const auto* to_decimal_type =
144
7
                            check_and_get_data_type<ToDataType>(to_type.get());
145
7
                    to_precision = to_decimal_type->get_precision();
146
7
                    ToDataType::check_type_precision(to_precision);
147
148
7
                    to_scale = to_decimal_type->get_scale();
149
7
                    ToDataType::check_type_scale(to_scale);
150
7
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
7
                if (to_scale > from_scale) {
161
6
                    multiply_may_overflow &=
162
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
6
                }
164
7
                return narrow_integral || multiply_may_overflow;
165
7
            }
166
0
            return false;
167
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
114
106
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
106
            using Types2 = std::decay_t<decltype(types2)>;
116
106
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
106
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
106
                using FromFieldType = typename FromDataType::FieldType;
124
106
                using ToFieldType = typename ToDataType::FieldType;
125
106
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
106
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
106
                UInt32 to_max_digits = 0;
137
106
                UInt32 to_precision = 0;
138
106
                UInt32 to_scale = 0;
139
140
106
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
106
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
106
                    const auto* to_decimal_type =
144
106
                            check_and_get_data_type<ToDataType>(to_type.get());
145
106
                    to_precision = to_decimal_type->get_precision();
146
106
                    ToDataType::check_type_precision(to_precision);
147
148
106
                    to_scale = to_decimal_type->get_scale();
149
106
                    ToDataType::check_type_scale(to_scale);
150
106
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
106
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
106
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
106
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
106
                if (to_scale > from_scale) {
161
73
                    multiply_may_overflow &=
162
73
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
73
                }
164
106
                return narrow_integral || multiply_may_overflow;
165
106
            }
166
0
            return false;
167
106
        });
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
114
104
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
104
            using Types2 = std::decay_t<decltype(types2)>;
116
104
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
104
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
104
                using FromFieldType = typename FromDataType::FieldType;
124
104
                using ToFieldType = typename ToDataType::FieldType;
125
104
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
104
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
104
                UInt32 to_max_digits = 0;
137
104
                UInt32 to_precision = 0;
138
104
                UInt32 to_scale = 0;
139
140
104
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
104
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
104
                    const auto* to_decimal_type =
144
104
                            check_and_get_data_type<ToDataType>(to_type.get());
145
104
                    to_precision = to_decimal_type->get_precision();
146
104
                    ToDataType::check_type_precision(to_precision);
147
148
104
                    to_scale = to_decimal_type->get_scale();
149
104
                    ToDataType::check_type_scale(to_scale);
150
104
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
104
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
104
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
104
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
104
                if (to_scale > from_scale) {
161
71
                    multiply_may_overflow &=
162
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
71
                }
164
104
                return narrow_integral || multiply_may_overflow;
165
104
            }
166
0
            return false;
167
104
        });
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
114
122
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
122
            using Types2 = std::decay_t<decltype(types2)>;
116
122
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
122
                using FromFieldType = typename FromDataType::FieldType;
124
122
                using ToFieldType = typename ToDataType::FieldType;
125
122
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
122
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
122
                UInt32 to_max_digits = 0;
137
122
                UInt32 to_precision = 0;
138
122
                UInt32 to_scale = 0;
139
140
122
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
122
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
122
                    const auto* to_decimal_type =
144
122
                            check_and_get_data_type<ToDataType>(to_type.get());
145
122
                    to_precision = to_decimal_type->get_precision();
146
122
                    ToDataType::check_type_precision(to_precision);
147
148
122
                    to_scale = to_decimal_type->get_scale();
149
122
                    ToDataType::check_type_scale(to_scale);
150
122
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
122
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
122
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
122
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
122
                if (to_scale > from_scale) {
161
84
                    multiply_may_overflow &=
162
84
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
84
                }
164
122
                return narrow_integral || multiply_may_overflow;
165
122
            }
166
0
            return false;
167
122
        });
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
114
104
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
104
            using Types2 = std::decay_t<decltype(types2)>;
116
104
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
104
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
104
                using FromFieldType = typename FromDataType::FieldType;
124
104
                using ToFieldType = typename ToDataType::FieldType;
125
104
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
104
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
104
                UInt32 to_max_digits = 0;
137
104
                UInt32 to_precision = 0;
138
104
                UInt32 to_scale = 0;
139
140
104
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
104
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
104
                    const auto* to_decimal_type =
144
104
                            check_and_get_data_type<ToDataType>(to_type.get());
145
104
                    to_precision = to_decimal_type->get_precision();
146
104
                    ToDataType::check_type_precision(to_precision);
147
148
104
                    to_scale = to_decimal_type->get_scale();
149
104
                    ToDataType::check_type_scale(to_scale);
150
104
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
104
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
104
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
104
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
104
                if (to_scale > from_scale) {
161
71
                    multiply_may_overflow &=
162
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
71
                }
164
104
                return narrow_integral || multiply_may_overflow;
165
104
            }
166
0
            return false;
167
104
        });
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
114
166
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
166
            using Types2 = std::decay_t<decltype(types2)>;
116
166
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
166
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
166
                using FromFieldType = typename FromDataType::FieldType;
124
166
                using ToFieldType = typename ToDataType::FieldType;
125
166
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
166
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
166
                UInt32 to_max_digits = 0;
137
166
                UInt32 to_precision = 0;
138
166
                UInt32 to_scale = 0;
139
140
166
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
166
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
166
                    const auto* to_decimal_type =
144
166
                            check_and_get_data_type<ToDataType>(to_type.get());
145
166
                    to_precision = to_decimal_type->get_precision();
146
166
                    ToDataType::check_type_precision(to_precision);
147
148
166
                    to_scale = to_decimal_type->get_scale();
149
166
                    ToDataType::check_type_scale(to_scale);
150
166
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
166
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
166
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
166
                if (to_scale > from_scale) {
161
122
                    multiply_may_overflow &=
162
122
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
122
                }
164
166
                return narrow_integral || multiply_may_overflow;
165
166
            }
166
0
            return false;
167
166
        });
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
114
180
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
180
            using Types2 = std::decay_t<decltype(types2)>;
116
180
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
180
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
180
                using FromFieldType = typename FromDataType::FieldType;
124
180
                using ToFieldType = typename ToDataType::FieldType;
125
180
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
180
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
180
                UInt32 to_max_digits = 0;
137
180
                UInt32 to_precision = 0;
138
180
                UInt32 to_scale = 0;
139
140
180
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
180
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
180
                    const auto* to_decimal_type =
144
180
                            check_and_get_data_type<ToDataType>(to_type.get());
145
180
                    to_precision = to_decimal_type->get_precision();
146
180
                    ToDataType::check_type_precision(to_precision);
147
148
180
                    to_scale = to_decimal_type->get_scale();
149
180
                    ToDataType::check_type_scale(to_scale);
150
180
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
180
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
180
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
180
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
180
                if (to_scale > from_scale) {
161
114
                    multiply_may_overflow &=
162
114
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
114
                }
164
180
                return narrow_integral || multiply_may_overflow;
165
180
            }
166
0
            return false;
167
180
        });
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
114
276
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
276
            using Types2 = std::decay_t<decltype(types2)>;
116
276
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
276
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
276
                using FromFieldType = typename FromDataType::FieldType;
124
276
                using ToFieldType = typename ToDataType::FieldType;
125
276
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
276
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
276
                UInt32 to_max_digits = 0;
137
276
                UInt32 to_precision = 0;
138
276
                UInt32 to_scale = 0;
139
140
276
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
276
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
276
                    const auto* to_decimal_type =
144
276
                            check_and_get_data_type<ToDataType>(to_type.get());
145
276
                    to_precision = to_decimal_type->get_precision();
146
276
                    ToDataType::check_type_precision(to_precision);
147
148
276
                    to_scale = to_decimal_type->get_scale();
149
276
                    ToDataType::check_type_scale(to_scale);
150
276
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
276
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
276
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
276
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
276
                if (to_scale > from_scale) {
161
196
                    multiply_may_overflow &=
162
196
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
196
                }
164
276
                return narrow_integral || multiply_may_overflow;
165
276
            }
166
0
            return false;
167
276
        });
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
114
429
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
429
            using Types2 = std::decay_t<decltype(types2)>;
116
429
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
429
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
429
                using FromFieldType = typename FromDataType::FieldType;
124
429
                using ToFieldType = typename ToDataType::FieldType;
125
429
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
429
                UInt32 from_scale = 0;
127
128
429
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
429
                    const auto* from_decimal_type =
130
429
                            check_and_get_data_type<FromDataType>(from_type.get());
131
429
                    from_precision =
132
429
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
429
                    from_scale = from_decimal_type->get_scale();
134
429
                }
135
136
429
                UInt32 to_max_digits = 0;
137
429
                UInt32 to_precision = 0;
138
429
                UInt32 to_scale = 0;
139
140
429
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
429
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
429
                    const auto* to_decimal_type =
144
429
                            check_and_get_data_type<ToDataType>(to_type.get());
145
429
                    to_precision = to_decimal_type->get_precision();
146
429
                    ToDataType::check_type_precision(to_precision);
147
148
429
                    to_scale = to_decimal_type->get_scale();
149
429
                    ToDataType::check_type_scale(to_scale);
150
429
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
429
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
429
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
429
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
429
                if (to_scale > from_scale) {
161
361
                    multiply_may_overflow &=
162
361
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
361
                }
164
429
                return narrow_integral || multiply_may_overflow;
165
429
            }
166
0
            return false;
167
429
        });
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
114
671
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
671
            using Types2 = std::decay_t<decltype(types2)>;
116
671
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
671
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
671
                using FromFieldType = typename FromDataType::FieldType;
124
671
                using ToFieldType = typename ToDataType::FieldType;
125
671
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
671
                UInt32 from_scale = 0;
127
128
671
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
671
                    const auto* from_decimal_type =
130
671
                            check_and_get_data_type<FromDataType>(from_type.get());
131
671
                    from_precision =
132
671
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
671
                    from_scale = from_decimal_type->get_scale();
134
671
                }
135
136
671
                UInt32 to_max_digits = 0;
137
671
                UInt32 to_precision = 0;
138
671
                UInt32 to_scale = 0;
139
140
671
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
671
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
671
                    const auto* to_decimal_type =
144
671
                            check_and_get_data_type<ToDataType>(to_type.get());
145
671
                    to_precision = to_decimal_type->get_precision();
146
671
                    ToDataType::check_type_precision(to_precision);
147
148
671
                    to_scale = to_decimal_type->get_scale();
149
671
                    ToDataType::check_type_scale(to_scale);
150
671
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
671
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
671
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
671
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
671
                if (to_scale > from_scale) {
161
544
                    multiply_may_overflow &=
162
544
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
544
                }
164
671
                return narrow_integral || multiply_may_overflow;
165
671
            }
166
0
            return false;
167
671
        });
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
114
148
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
148
            using Types2 = std::decay_t<decltype(types2)>;
116
148
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
148
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
148
                using FromFieldType = typename FromDataType::FieldType;
124
148
                using ToFieldType = typename ToDataType::FieldType;
125
148
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
148
                UInt32 from_scale = 0;
127
128
148
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
148
                    const auto* from_decimal_type =
130
148
                            check_and_get_data_type<FromDataType>(from_type.get());
131
148
                    from_precision =
132
148
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
148
                    from_scale = from_decimal_type->get_scale();
134
148
                }
135
136
148
                UInt32 to_max_digits = 0;
137
148
                UInt32 to_precision = 0;
138
148
                UInt32 to_scale = 0;
139
140
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
148
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
148
                    const auto* to_decimal_type =
144
148
                            check_and_get_data_type<ToDataType>(to_type.get());
145
148
                    to_precision = to_decimal_type->get_precision();
146
148
                    ToDataType::check_type_precision(to_precision);
147
148
148
                    to_scale = to_decimal_type->get_scale();
149
148
                    ToDataType::check_type_scale(to_scale);
150
148
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
148
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
148
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
148
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
148
                if (to_scale > from_scale) {
161
84
                    multiply_may_overflow &=
162
84
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
84
                }
164
148
                return narrow_integral || multiply_may_overflow;
165
148
            }
166
0
            return false;
167
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
114
957
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
957
            using Types2 = std::decay_t<decltype(types2)>;
116
957
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
957
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
957
                using FromFieldType = typename FromDataType::FieldType;
124
957
                using ToFieldType = typename ToDataType::FieldType;
125
957
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
957
                UInt32 from_scale = 0;
127
128
957
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
957
                    const auto* from_decimal_type =
130
957
                            check_and_get_data_type<FromDataType>(from_type.get());
131
957
                    from_precision =
132
957
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
957
                    from_scale = from_decimal_type->get_scale();
134
957
                }
135
136
957
                UInt32 to_max_digits = 0;
137
957
                UInt32 to_precision = 0;
138
957
                UInt32 to_scale = 0;
139
140
957
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
957
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
957
                    const auto* to_decimal_type =
144
957
                            check_and_get_data_type<ToDataType>(to_type.get());
145
957
                    to_precision = to_decimal_type->get_precision();
146
957
                    ToDataType::check_type_precision(to_precision);
147
148
957
                    to_scale = to_decimal_type->get_scale();
149
957
                    ToDataType::check_type_scale(to_scale);
150
957
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
957
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
957
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
957
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
957
                if (to_scale > from_scale) {
161
508
                    multiply_may_overflow &=
162
508
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
508
                }
164
957
                return narrow_integral || multiply_may_overflow;
165
957
            }
166
0
            return false;
167
957
        });
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
114
684
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
684
            using Types2 = std::decay_t<decltype(types2)>;
116
684
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
684
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
684
                using FromFieldType = typename FromDataType::FieldType;
124
684
                using ToFieldType = typename ToDataType::FieldType;
125
684
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
684
                UInt32 from_scale = 0;
127
128
684
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
684
                    const auto* from_decimal_type =
130
684
                            check_and_get_data_type<FromDataType>(from_type.get());
131
684
                    from_precision =
132
684
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
684
                    from_scale = from_decimal_type->get_scale();
134
684
                }
135
136
684
                UInt32 to_max_digits = 0;
137
684
                UInt32 to_precision = 0;
138
684
                UInt32 to_scale = 0;
139
140
684
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
684
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
684
                    const auto* to_decimal_type =
144
684
                            check_and_get_data_type<ToDataType>(to_type.get());
145
684
                    to_precision = to_decimal_type->get_precision();
146
684
                    ToDataType::check_type_precision(to_precision);
147
148
684
                    to_scale = to_decimal_type->get_scale();
149
684
                    ToDataType::check_type_scale(to_scale);
150
684
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
684
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
684
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
684
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
684
                if (to_scale > from_scale) {
161
332
                    multiply_may_overflow &=
162
332
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
332
                }
164
684
                return narrow_integral || multiply_may_overflow;
165
684
            }
166
0
            return false;
167
684
        });
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
114
3.57k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3.57k
            using Types2 = std::decay_t<decltype(types2)>;
116
3.57k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
3.57k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
3.57k
                return false;
121
3.57k
            }
122
3.57k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
3.57k
                using FromFieldType = typename FromDataType::FieldType;
124
3.57k
                using ToFieldType = typename ToDataType::FieldType;
125
3.57k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
3.57k
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
3.57k
                UInt32 to_max_digits = 0;
137
3.57k
                UInt32 to_precision = 0;
138
3.57k
                UInt32 to_scale = 0;
139
140
3.57k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
3.57k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
3.57k
                    const auto* to_decimal_type =
144
3.57k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
3.57k
                    to_precision = to_decimal_type->get_precision();
146
3.57k
                    ToDataType::check_type_precision(to_precision);
147
148
3.57k
                    to_scale = to_decimal_type->get_scale();
149
3.57k
                    ToDataType::check_type_scale(to_scale);
150
3.57k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
3.57k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
3.57k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
3.57k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
3.57k
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
3.57k
                return narrow_integral || multiply_may_overflow;
165
3.57k
            }
166
0
            return false;
167
3.57k
        });
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
114
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1
            using Types2 = std::decay_t<decltype(types2)>;
116
1
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1
            return false;
167
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
114
3
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3
            using Types2 = std::decay_t<decltype(types2)>;
116
3
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
3
            return false;
167
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
114
26
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
26
            using Types2 = std::decay_t<decltype(types2)>;
116
26
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
26
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
26
                return false;
121
26
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
26
            return false;
167
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
114
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
10
            using Types2 = std::decay_t<decltype(types2)>;
116
10
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
10
            return false;
167
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
114
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7
            using Types2 = std::decay_t<decltype(types2)>;
116
7
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
7
            return false;
167
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
114
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7
            using Types2 = std::decay_t<decltype(types2)>;
116
7
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
7
            return false;
167
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
114
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2
            using Types2 = std::decay_t<decltype(types2)>;
116
2
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
2
                using FromFieldType = typename FromDataType::FieldType;
124
2
                using ToFieldType = typename ToDataType::FieldType;
125
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
2
                UInt32 from_scale = 0;
127
128
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
2
                    const auto* from_decimal_type =
130
2
                            check_and_get_data_type<FromDataType>(from_type.get());
131
2
                    from_precision =
132
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
2
                    from_scale = from_decimal_type->get_scale();
134
2
                }
135
136
2
                UInt32 to_max_digits = 0;
137
2
                UInt32 to_precision = 0;
138
2
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
2
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
2
                return narrow_integral || multiply_may_overflow;
165
2
            }
166
0
            return false;
167
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
114
35
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
35
            using Types2 = std::decay_t<decltype(types2)>;
116
35
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
35
            return false;
167
35
        });
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
114
220
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
220
            using Types2 = std::decay_t<decltype(types2)>;
116
220
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
220
            return false;
167
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
114
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1
            using Types2 = std::decay_t<decltype(types2)>;
116
1
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1
            return false;
167
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
114
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2
            using Types2 = std::decay_t<decltype(types2)>;
116
2
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
2
            return false;
167
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
114
5.31k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
5.31k
            using Types2 = std::decay_t<decltype(types2)>;
116
5.31k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
5.31k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
5.31k
                return false;
121
5.31k
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
5.31k
            return false;
167
5.31k
        });
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
114
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
12
            using Types2 = std::decay_t<decltype(types2)>;
116
12
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
12
            return false;
167
12
        });
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
114
32
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
32
            using Types2 = std::decay_t<decltype(types2)>;
116
32
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
32
            return false;
167
32
        });
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
114
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
12
            using Types2 = std::decay_t<decltype(types2)>;
116
12
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
12
            return false;
167
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
114
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
18
            using Types2 = std::decay_t<decltype(types2)>;
116
18
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
18
                using FromFieldType = typename FromDataType::FieldType;
124
18
                using ToFieldType = typename ToDataType::FieldType;
125
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
18
                UInt32 from_scale = 0;
127
128
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
18
                    const auto* from_decimal_type =
130
18
                            check_and_get_data_type<FromDataType>(from_type.get());
131
18
                    from_precision =
132
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
18
                    from_scale = from_decimal_type->get_scale();
134
18
                }
135
136
18
                UInt32 to_max_digits = 0;
137
18
                UInt32 to_precision = 0;
138
18
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
18
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
18
                return narrow_integral || multiply_may_overflow;
165
18
            }
166
0
            return false;
167
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Line
Count
Source
114
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
14
            using Types2 = std::decay_t<decltype(types2)>;
116
14
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
14
                using FromFieldType = typename FromDataType::FieldType;
124
14
                using ToFieldType = typename ToDataType::FieldType;
125
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
14
                UInt32 from_scale = 0;
127
128
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
14
                    const auto* from_decimal_type =
130
14
                            check_and_get_data_type<FromDataType>(from_type.get());
131
14
                    from_precision =
132
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
14
                    from_scale = from_decimal_type->get_scale();
134
14
                }
135
136
14
                UInt32 to_max_digits = 0;
137
14
                UInt32 to_precision = 0;
138
14
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
14
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
14
                return narrow_integral || multiply_may_overflow;
165
14
            }
166
0
            return false;
167
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
114
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
5
            using Types2 = std::decay_t<decltype(types2)>;
116
5
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
5
                using FromFieldType = typename FromDataType::FieldType;
124
5
                using ToFieldType = typename ToDataType::FieldType;
125
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
5
                UInt32 from_scale = 0;
127
128
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
5
                    const auto* from_decimal_type =
130
5
                            check_and_get_data_type<FromDataType>(from_type.get());
131
5
                    from_precision =
132
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
5
                    from_scale = from_decimal_type->get_scale();
134
5
                }
135
136
5
                UInt32 to_max_digits = 0;
137
5
                UInt32 to_precision = 0;
138
5
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
5
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
5
                return narrow_integral || multiply_may_overflow;
165
5
            }
166
0
            return false;
167
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
114
377
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
377
            using Types2 = std::decay_t<decltype(types2)>;
116
377
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
377
            return false;
167
377
        });
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
114
105
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
105
            using Types2 = std::decay_t<decltype(types2)>;
116
105
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
105
            return false;
167
105
        });
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
114
42
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
42
            using Types2 = std::decay_t<decltype(types2)>;
116
42
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
42
            return false;
167
42
        });
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
114
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
4
            using Types2 = std::decay_t<decltype(types2)>;
116
4
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
4
            return false;
167
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
114
46
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
46
            using Types2 = std::decay_t<decltype(types2)>;
116
46
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
46
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
46
                return false;
121
46
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
46
            return false;
167
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
114
2.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.78k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.78k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
2.78k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
2.78k
                return false;
121
2.78k
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
2.78k
            return false;
167
2.78k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
114
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
25
            using Types2 = std::decay_t<decltype(types2)>;
116
25
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
25
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
25
                return false;
121
25
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
25
            return false;
167
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
114
28
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
28
            using Types2 = std::decay_t<decltype(types2)>;
116
28
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
28
            return false;
167
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
114
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
21
            using Types2 = std::decay_t<decltype(types2)>;
116
21
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
21
            return false;
167
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
114
33
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
33
            using Types2 = std::decay_t<decltype(types2)>;
116
33
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
33
            return false;
167
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
114
9
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
9
            using Types2 = std::decay_t<decltype(types2)>;
116
9
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
9
            return false;
167
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
114
3
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3
            using Types2 = std::decay_t<decltype(types2)>;
116
3
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
3
            return false;
167
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
114
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7
            using Types2 = std::decay_t<decltype(types2)>;
116
7
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
7
            return false;
167
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
114
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
18
            using Types2 = std::decay_t<decltype(types2)>;
116
18
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
18
            return false;
167
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
114
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2
            using Types2 = std::decay_t<decltype(types2)>;
116
2
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
2
                using FromFieldType = typename FromDataType::FieldType;
124
2
                using ToFieldType = typename ToDataType::FieldType;
125
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
2
                UInt32 from_scale = 0;
127
128
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
2
                    const auto* from_decimal_type =
130
2
                            check_and_get_data_type<FromDataType>(from_type.get());
131
2
                    from_precision =
132
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
2
                    from_scale = from_decimal_type->get_scale();
134
2
                }
135
136
2
                UInt32 to_max_digits = 0;
137
2
                UInt32 to_precision = 0;
138
2
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
2
                    to_precision = to_max_digits;
154
2
                }
155
156
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
2
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
2
                return narrow_integral || multiply_may_overflow;
165
2
            }
166
0
            return false;
167
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
114
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1
            using Types2 = std::decay_t<decltype(types2)>;
116
1
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1
                using FromFieldType = typename FromDataType::FieldType;
124
1
                using ToFieldType = typename ToDataType::FieldType;
125
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1
                UInt32 from_scale = 0;
127
128
1
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
1
                    const auto* from_decimal_type =
130
1
                            check_and_get_data_type<FromDataType>(from_type.get());
131
1
                    from_precision =
132
1
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
1
                    from_scale = from_decimal_type->get_scale();
134
1
                }
135
136
1
                UInt32 to_max_digits = 0;
137
1
                UInt32 to_precision = 0;
138
1
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
1
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
1
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
1
                    to_precision = to_max_digits;
154
1
                }
155
156
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
1
                return narrow_integral || multiply_may_overflow;
165
1
            }
166
0
            return false;
167
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
114
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1
            using Types2 = std::decay_t<decltype(types2)>;
116
1
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1
                using FromFieldType = typename FromDataType::FieldType;
124
1
                using ToFieldType = typename ToDataType::FieldType;
125
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1
                UInt32 from_scale = 0;
127
128
1
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
1
                    const auto* from_decimal_type =
130
1
                            check_and_get_data_type<FromDataType>(from_type.get());
131
1
                    from_precision =
132
1
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
1
                    from_scale = from_decimal_type->get_scale();
134
1
                }
135
136
1
                UInt32 to_max_digits = 0;
137
1
                UInt32 to_precision = 0;
138
1
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
1
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
1
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
1
                    to_precision = to_max_digits;
154
1
                }
155
156
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
1
                return narrow_integral || multiply_may_overflow;
165
1
            }
166
0
            return false;
167
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
114
11
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
11
            using Types2 = std::decay_t<decltype(types2)>;
116
11
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
11
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
11
                using FromFieldType = typename FromDataType::FieldType;
124
11
                using ToFieldType = typename ToDataType::FieldType;
125
11
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
11
                UInt32 from_scale = 0;
127
128
11
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
11
                    const auto* from_decimal_type =
130
11
                            check_and_get_data_type<FromDataType>(from_type.get());
131
11
                    from_precision =
132
11
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
11
                    from_scale = from_decimal_type->get_scale();
134
11
                }
135
136
11
                UInt32 to_max_digits = 0;
137
11
                UInt32 to_precision = 0;
138
11
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
11
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
11
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
11
                    to_precision = to_max_digits;
154
11
                }
155
156
11
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
11
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
11
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
11
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
11
                return narrow_integral || multiply_may_overflow;
165
11
            }
166
0
            return false;
167
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
114
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
8
            using Types2 = std::decay_t<decltype(types2)>;
116
8
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
8
            return false;
167
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
114
19
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
19
            using Types2 = std::decay_t<decltype(types2)>;
116
19
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
19
            return false;
167
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
114
231
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
231
            using Types2 = std::decay_t<decltype(types2)>;
116
231
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
231
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
231
                return false;
121
231
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
231
            return false;
167
231
        });
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_
168
191k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
104
2.34k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
2.34k
        using Types = std::decay_t<decltype(types)>;
106
2.34k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
2.34k
        return call_on_index_and_data_type<
114
2.34k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.34k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.34k
            using FromDataType = typename Types2::LeftType;
117
2.34k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
2.34k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
2.34k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
2.34k
                return false;
121
2.34k
            }
122
2.34k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
2.34k
                using FromFieldType = typename FromDataType::FieldType;
124
2.34k
                using ToFieldType = typename ToDataType::FieldType;
125
2.34k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
2.34k
                UInt32 from_scale = 0;
127
128
2.34k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
2.34k
                    const auto* from_decimal_type =
130
2.34k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
2.34k
                    from_precision =
132
2.34k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
2.34k
                    from_scale = from_decimal_type->get_scale();
134
2.34k
                }
135
136
2.34k
                UInt32 to_max_digits = 0;
137
2.34k
                UInt32 to_precision = 0;
138
2.34k
                UInt32 to_scale = 0;
139
140
2.34k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
2.34k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
2.34k
                    const auto* to_decimal_type =
144
2.34k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
2.34k
                    to_precision = to_decimal_type->get_precision();
146
2.34k
                    ToDataType::check_type_precision(to_precision);
147
148
2.34k
                    to_scale = to_decimal_type->get_scale();
149
2.34k
                    ToDataType::check_type_scale(to_scale);
150
2.34k
                }
151
2.34k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
2.34k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
2.34k
                    to_precision = to_max_digits;
154
2.34k
                }
155
156
2.34k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
2.34k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
2.34k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
2.34k
                if (to_scale > from_scale) {
161
2.34k
                    multiply_may_overflow &=
162
2.34k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
2.34k
                }
164
2.34k
                return narrow_integral || multiply_may_overflow;
165
2.34k
            }
166
2.34k
            return false;
167
2.34k
        });
168
2.34k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
104
3.69k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
3.69k
        using Types = std::decay_t<decltype(types)>;
106
3.69k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
3.69k
        return call_on_index_and_data_type<
114
3.69k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3.69k
            using Types2 = std::decay_t<decltype(types2)>;
116
3.69k
            using FromDataType = typename Types2::LeftType;
117
3.69k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
3.69k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
3.69k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
3.69k
                return false;
121
3.69k
            }
122
3.69k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
3.69k
                using FromFieldType = typename FromDataType::FieldType;
124
3.69k
                using ToFieldType = typename ToDataType::FieldType;
125
3.69k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
3.69k
                UInt32 from_scale = 0;
127
128
3.69k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
3.69k
                    const auto* from_decimal_type =
130
3.69k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
3.69k
                    from_precision =
132
3.69k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
3.69k
                    from_scale = from_decimal_type->get_scale();
134
3.69k
                }
135
136
3.69k
                UInt32 to_max_digits = 0;
137
3.69k
                UInt32 to_precision = 0;
138
3.69k
                UInt32 to_scale = 0;
139
140
3.69k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
3.69k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
3.69k
                    const auto* to_decimal_type =
144
3.69k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
3.69k
                    to_precision = to_decimal_type->get_precision();
146
3.69k
                    ToDataType::check_type_precision(to_precision);
147
148
3.69k
                    to_scale = to_decimal_type->get_scale();
149
3.69k
                    ToDataType::check_type_scale(to_scale);
150
3.69k
                }
151
3.69k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
3.69k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
3.69k
                    to_precision = to_max_digits;
154
3.69k
                }
155
156
3.69k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
3.69k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
3.69k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
3.69k
                if (to_scale > from_scale) {
161
3.69k
                    multiply_may_overflow &=
162
3.69k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
3.69k
                }
164
3.69k
                return narrow_integral || multiply_may_overflow;
165
3.69k
            }
166
3.69k
            return false;
167
3.69k
        });
168
3.69k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
104
5.18k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
5.18k
        using Types = std::decay_t<decltype(types)>;
106
5.18k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
5.18k
        return call_on_index_and_data_type<
114
5.18k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
5.18k
            using Types2 = std::decay_t<decltype(types2)>;
116
5.18k
            using FromDataType = typename Types2::LeftType;
117
5.18k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
5.18k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
5.18k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
5.18k
                return false;
121
5.18k
            }
122
5.18k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
5.18k
                using FromFieldType = typename FromDataType::FieldType;
124
5.18k
                using ToFieldType = typename ToDataType::FieldType;
125
5.18k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
5.18k
                UInt32 from_scale = 0;
127
128
5.18k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
5.18k
                    const auto* from_decimal_type =
130
5.18k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
5.18k
                    from_precision =
132
5.18k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
5.18k
                    from_scale = from_decimal_type->get_scale();
134
5.18k
                }
135
136
5.18k
                UInt32 to_max_digits = 0;
137
5.18k
                UInt32 to_precision = 0;
138
5.18k
                UInt32 to_scale = 0;
139
140
5.18k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
5.18k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
5.18k
                    const auto* to_decimal_type =
144
5.18k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
5.18k
                    to_precision = to_decimal_type->get_precision();
146
5.18k
                    ToDataType::check_type_precision(to_precision);
147
148
5.18k
                    to_scale = to_decimal_type->get_scale();
149
5.18k
                    ToDataType::check_type_scale(to_scale);
150
5.18k
                }
151
5.18k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
5.18k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
5.18k
                    to_precision = to_max_digits;
154
5.18k
                }
155
156
5.18k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
5.18k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
5.18k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
5.18k
                if (to_scale > from_scale) {
161
5.18k
                    multiply_may_overflow &=
162
5.18k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
5.18k
                }
164
5.18k
                return narrow_integral || multiply_may_overflow;
165
5.18k
            }
166
5.18k
            return false;
167
5.18k
        });
168
5.18k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
104
29.0k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
29.0k
        using Types = std::decay_t<decltype(types)>;
106
29.0k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
29.0k
        return call_on_index_and_data_type<
114
29.0k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
29.0k
            using Types2 = std::decay_t<decltype(types2)>;
116
29.0k
            using FromDataType = typename Types2::LeftType;
117
29.0k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
29.0k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
29.0k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
29.0k
                return false;
121
29.0k
            }
122
29.0k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
29.0k
                using FromFieldType = typename FromDataType::FieldType;
124
29.0k
                using ToFieldType = typename ToDataType::FieldType;
125
29.0k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
29.0k
                UInt32 from_scale = 0;
127
128
29.0k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
29.0k
                    const auto* from_decimal_type =
130
29.0k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
29.0k
                    from_precision =
132
29.0k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
29.0k
                    from_scale = from_decimal_type->get_scale();
134
29.0k
                }
135
136
29.0k
                UInt32 to_max_digits = 0;
137
29.0k
                UInt32 to_precision = 0;
138
29.0k
                UInt32 to_scale = 0;
139
140
29.0k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
29.0k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
29.0k
                    const auto* to_decimal_type =
144
29.0k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
29.0k
                    to_precision = to_decimal_type->get_precision();
146
29.0k
                    ToDataType::check_type_precision(to_precision);
147
148
29.0k
                    to_scale = to_decimal_type->get_scale();
149
29.0k
                    ToDataType::check_type_scale(to_scale);
150
29.0k
                }
151
29.0k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
29.0k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
29.0k
                    to_precision = to_max_digits;
154
29.0k
                }
155
156
29.0k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
29.0k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
29.0k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
29.0k
                if (to_scale > from_scale) {
161
29.0k
                    multiply_may_overflow &=
162
29.0k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
29.0k
                }
164
29.0k
                return narrow_integral || multiply_may_overflow;
165
29.0k
            }
166
29.0k
            return false;
167
29.0k
        });
168
29.0k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
104
34.4k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
34.4k
        using Types = std::decay_t<decltype(types)>;
106
34.4k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
34.4k
        return call_on_index_and_data_type<
114
34.4k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
34.4k
            using Types2 = std::decay_t<decltype(types2)>;
116
34.4k
            using FromDataType = typename Types2::LeftType;
117
34.4k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
34.4k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
34.4k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
34.4k
                return false;
121
34.4k
            }
122
34.4k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
34.4k
                using FromFieldType = typename FromDataType::FieldType;
124
34.4k
                using ToFieldType = typename ToDataType::FieldType;
125
34.4k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
34.4k
                UInt32 from_scale = 0;
127
128
34.4k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
34.4k
                    const auto* from_decimal_type =
130
34.4k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
34.4k
                    from_precision =
132
34.4k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
34.4k
                    from_scale = from_decimal_type->get_scale();
134
34.4k
                }
135
136
34.4k
                UInt32 to_max_digits = 0;
137
34.4k
                UInt32 to_precision = 0;
138
34.4k
                UInt32 to_scale = 0;
139
140
34.4k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
34.4k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
34.4k
                    const auto* to_decimal_type =
144
34.4k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
34.4k
                    to_precision = to_decimal_type->get_precision();
146
34.4k
                    ToDataType::check_type_precision(to_precision);
147
148
34.4k
                    to_scale = to_decimal_type->get_scale();
149
34.4k
                    ToDataType::check_type_scale(to_scale);
150
34.4k
                }
151
34.4k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
34.4k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
34.4k
                    to_precision = to_max_digits;
154
34.4k
                }
155
156
34.4k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
34.4k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
34.4k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
34.4k
                if (to_scale > from_scale) {
161
34.4k
                    multiply_may_overflow &=
162
34.4k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
34.4k
                }
164
34.4k
                return narrow_integral || multiply_may_overflow;
165
34.4k
            }
166
34.4k
            return false;
167
34.4k
        });
168
34.4k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
104
4.61k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
4.61k
        using Types = std::decay_t<decltype(types)>;
106
4.61k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
4.61k
        return call_on_index_and_data_type<
114
4.61k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
4.61k
            using Types2 = std::decay_t<decltype(types2)>;
116
4.61k
            using FromDataType = typename Types2::LeftType;
117
4.61k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
4.61k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
4.61k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
4.61k
                return false;
121
4.61k
            }
122
4.61k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
4.61k
                using FromFieldType = typename FromDataType::FieldType;
124
4.61k
                using ToFieldType = typename ToDataType::FieldType;
125
4.61k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
4.61k
                UInt32 from_scale = 0;
127
128
4.61k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
4.61k
                    const auto* from_decimal_type =
130
4.61k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
4.61k
                    from_precision =
132
4.61k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
4.61k
                    from_scale = from_decimal_type->get_scale();
134
4.61k
                }
135
136
4.61k
                UInt32 to_max_digits = 0;
137
4.61k
                UInt32 to_precision = 0;
138
4.61k
                UInt32 to_scale = 0;
139
140
4.61k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
4.61k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
4.61k
                    const auto* to_decimal_type =
144
4.61k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
4.61k
                    to_precision = to_decimal_type->get_precision();
146
4.61k
                    ToDataType::check_type_precision(to_precision);
147
148
4.61k
                    to_scale = to_decimal_type->get_scale();
149
4.61k
                    ToDataType::check_type_scale(to_scale);
150
4.61k
                }
151
4.61k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
4.61k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
4.61k
                    to_precision = to_max_digits;
154
4.61k
                }
155
156
4.61k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
4.61k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
4.61k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
4.61k
                if (to_scale > from_scale) {
161
4.61k
                    multiply_may_overflow &=
162
4.61k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
4.61k
                }
164
4.61k
                return narrow_integral || multiply_may_overflow;
165
4.61k
            }
166
4.61k
            return false;
167
4.61k
        });
168
4.61k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
104
10.0k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
10.0k
        using Types = std::decay_t<decltype(types)>;
106
10.0k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
10.0k
        return call_on_index_and_data_type<
114
10.0k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
10.0k
            using Types2 = std::decay_t<decltype(types2)>;
116
10.0k
            using FromDataType = typename Types2::LeftType;
117
10.0k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
10.0k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
10.0k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
10.0k
                return false;
121
10.0k
            }
122
10.0k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
10.0k
                using FromFieldType = typename FromDataType::FieldType;
124
10.0k
                using ToFieldType = typename ToDataType::FieldType;
125
10.0k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
10.0k
                UInt32 from_scale = 0;
127
128
10.0k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
10.0k
                    const auto* from_decimal_type =
130
10.0k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
10.0k
                    from_precision =
132
10.0k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
10.0k
                    from_scale = from_decimal_type->get_scale();
134
10.0k
                }
135
136
10.0k
                UInt32 to_max_digits = 0;
137
10.0k
                UInt32 to_precision = 0;
138
10.0k
                UInt32 to_scale = 0;
139
140
10.0k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
10.0k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
10.0k
                    const auto* to_decimal_type =
144
10.0k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
10.0k
                    to_precision = to_decimal_type->get_precision();
146
10.0k
                    ToDataType::check_type_precision(to_precision);
147
148
10.0k
                    to_scale = to_decimal_type->get_scale();
149
10.0k
                    ToDataType::check_type_scale(to_scale);
150
10.0k
                }
151
10.0k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
10.0k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
10.0k
                    to_precision = to_max_digits;
154
10.0k
                }
155
156
10.0k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
10.0k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
10.0k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
10.0k
                if (to_scale > from_scale) {
161
10.0k
                    multiply_may_overflow &=
162
10.0k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
10.0k
                }
164
10.0k
                return narrow_integral || multiply_may_overflow;
165
10.0k
            }
166
10.0k
            return false;
167
10.0k
        });
168
10.0k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
104
23.7k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
23.7k
        using Types = std::decay_t<decltype(types)>;
106
23.7k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
23.7k
        return call_on_index_and_data_type<
114
23.7k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
23.7k
            using Types2 = std::decay_t<decltype(types2)>;
116
23.7k
            using FromDataType = typename Types2::LeftType;
117
23.7k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
23.7k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
23.7k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
23.7k
                return false;
121
23.7k
            }
122
23.7k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
23.7k
                using FromFieldType = typename FromDataType::FieldType;
124
23.7k
                using ToFieldType = typename ToDataType::FieldType;
125
23.7k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
23.7k
                UInt32 from_scale = 0;
127
128
23.7k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
23.7k
                    const auto* from_decimal_type =
130
23.7k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
23.7k
                    from_precision =
132
23.7k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
23.7k
                    from_scale = from_decimal_type->get_scale();
134
23.7k
                }
135
136
23.7k
                UInt32 to_max_digits = 0;
137
23.7k
                UInt32 to_precision = 0;
138
23.7k
                UInt32 to_scale = 0;
139
140
23.7k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
23.7k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
23.7k
                    const auto* to_decimal_type =
144
23.7k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
23.7k
                    to_precision = to_decimal_type->get_precision();
146
23.7k
                    ToDataType::check_type_precision(to_precision);
147
148
23.7k
                    to_scale = to_decimal_type->get_scale();
149
23.7k
                    ToDataType::check_type_scale(to_scale);
150
23.7k
                }
151
23.7k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
23.7k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
23.7k
                    to_precision = to_max_digits;
154
23.7k
                }
155
156
23.7k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
23.7k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
23.7k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
23.7k
                if (to_scale > from_scale) {
161
23.7k
                    multiply_may_overflow &=
162
23.7k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
23.7k
                }
164
23.7k
                return narrow_integral || multiply_may_overflow;
165
23.7k
            }
166
23.7k
            return false;
167
23.7k
        });
168
23.7k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
104
6.55k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
6.55k
        using Types = std::decay_t<decltype(types)>;
106
6.55k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
6.55k
        return call_on_index_and_data_type<
114
6.55k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
6.55k
            using Types2 = std::decay_t<decltype(types2)>;
116
6.55k
            using FromDataType = typename Types2::LeftType;
117
6.55k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
6.55k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
6.55k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
6.55k
                return false;
121
6.55k
            }
122
6.55k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
6.55k
                using FromFieldType = typename FromDataType::FieldType;
124
6.55k
                using ToFieldType = typename ToDataType::FieldType;
125
6.55k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
6.55k
                UInt32 from_scale = 0;
127
128
6.55k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
6.55k
                    const auto* from_decimal_type =
130
6.55k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
6.55k
                    from_precision =
132
6.55k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
6.55k
                    from_scale = from_decimal_type->get_scale();
134
6.55k
                }
135
136
6.55k
                UInt32 to_max_digits = 0;
137
6.55k
                UInt32 to_precision = 0;
138
6.55k
                UInt32 to_scale = 0;
139
140
6.55k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
6.55k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
6.55k
                    const auto* to_decimal_type =
144
6.55k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
6.55k
                    to_precision = to_decimal_type->get_precision();
146
6.55k
                    ToDataType::check_type_precision(to_precision);
147
148
6.55k
                    to_scale = to_decimal_type->get_scale();
149
6.55k
                    ToDataType::check_type_scale(to_scale);
150
6.55k
                }
151
6.55k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
6.55k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
6.55k
                    to_precision = to_max_digits;
154
6.55k
                }
155
156
6.55k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
6.55k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
6.55k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
6.55k
                if (to_scale > from_scale) {
161
6.55k
                    multiply_may_overflow &=
162
6.55k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
6.55k
                }
164
6.55k
                return narrow_integral || multiply_may_overflow;
165
6.55k
            }
166
6.55k
            return false;
167
6.55k
        });
168
6.55k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
104
10.7k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
10.7k
        using Types = std::decay_t<decltype(types)>;
106
10.7k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
10.7k
        return call_on_index_and_data_type<
114
10.7k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
10.7k
            using Types2 = std::decay_t<decltype(types2)>;
116
10.7k
            using FromDataType = typename Types2::LeftType;
117
10.7k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
10.7k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
10.7k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
10.7k
                return false;
121
10.7k
            }
122
10.7k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
10.7k
                using FromFieldType = typename FromDataType::FieldType;
124
10.7k
                using ToFieldType = typename ToDataType::FieldType;
125
10.7k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
10.7k
                UInt32 from_scale = 0;
127
128
10.7k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
10.7k
                    const auto* from_decimal_type =
130
10.7k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
10.7k
                    from_precision =
132
10.7k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
10.7k
                    from_scale = from_decimal_type->get_scale();
134
10.7k
                }
135
136
10.7k
                UInt32 to_max_digits = 0;
137
10.7k
                UInt32 to_precision = 0;
138
10.7k
                UInt32 to_scale = 0;
139
140
10.7k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
10.7k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
10.7k
                    const auto* to_decimal_type =
144
10.7k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
10.7k
                    to_precision = to_decimal_type->get_precision();
146
10.7k
                    ToDataType::check_type_precision(to_precision);
147
148
10.7k
                    to_scale = to_decimal_type->get_scale();
149
10.7k
                    ToDataType::check_type_scale(to_scale);
150
10.7k
                }
151
10.7k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
10.7k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
10.7k
                    to_precision = to_max_digits;
154
10.7k
                }
155
156
10.7k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
10.7k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
10.7k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
10.7k
                if (to_scale > from_scale) {
161
10.7k
                    multiply_may_overflow &=
162
10.7k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
10.7k
                }
164
10.7k
                return narrow_integral || multiply_may_overflow;
165
10.7k
            }
166
10.7k
            return false;
167
10.7k
        });
168
10.7k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
104
229
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
229
        using Types = std::decay_t<decltype(types)>;
106
229
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
229
        return call_on_index_and_data_type<
114
229
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
229
            using Types2 = std::decay_t<decltype(types2)>;
116
229
            using FromDataType = typename Types2::LeftType;
117
229
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
229
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
229
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
229
                return false;
121
229
            }
122
229
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
229
                using FromFieldType = typename FromDataType::FieldType;
124
229
                using ToFieldType = typename ToDataType::FieldType;
125
229
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
229
                UInt32 from_scale = 0;
127
128
229
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
229
                    const auto* from_decimal_type =
130
229
                            check_and_get_data_type<FromDataType>(from_type.get());
131
229
                    from_precision =
132
229
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
229
                    from_scale = from_decimal_type->get_scale();
134
229
                }
135
136
229
                UInt32 to_max_digits = 0;
137
229
                UInt32 to_precision = 0;
138
229
                UInt32 to_scale = 0;
139
140
229
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
229
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
229
                    const auto* to_decimal_type =
144
229
                            check_and_get_data_type<ToDataType>(to_type.get());
145
229
                    to_precision = to_decimal_type->get_precision();
146
229
                    ToDataType::check_type_precision(to_precision);
147
148
229
                    to_scale = to_decimal_type->get_scale();
149
229
                    ToDataType::check_type_scale(to_scale);
150
229
                }
151
229
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
229
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
229
                    to_precision = to_max_digits;
154
229
                }
155
156
229
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
229
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
229
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
229
                if (to_scale > from_scale) {
161
229
                    multiply_may_overflow &=
162
229
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
229
                }
164
229
                return narrow_integral || multiply_may_overflow;
165
229
            }
166
229
            return false;
167
229
        });
168
229
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
104
10.2k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
10.2k
        using Types = std::decay_t<decltype(types)>;
106
10.2k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
10.2k
        return call_on_index_and_data_type<
114
10.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
10.2k
            using Types2 = std::decay_t<decltype(types2)>;
116
10.2k
            using FromDataType = typename Types2::LeftType;
117
10.2k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
10.2k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
10.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
10.2k
                return false;
121
10.2k
            }
122
10.2k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
10.2k
                using FromFieldType = typename FromDataType::FieldType;
124
10.2k
                using ToFieldType = typename ToDataType::FieldType;
125
10.2k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
10.2k
                UInt32 from_scale = 0;
127
128
10.2k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
10.2k
                    const auto* from_decimal_type =
130
10.2k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
10.2k
                    from_precision =
132
10.2k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
10.2k
                    from_scale = from_decimal_type->get_scale();
134
10.2k
                }
135
136
10.2k
                UInt32 to_max_digits = 0;
137
10.2k
                UInt32 to_precision = 0;
138
10.2k
                UInt32 to_scale = 0;
139
140
10.2k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
10.2k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
10.2k
                    const auto* to_decimal_type =
144
10.2k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
10.2k
                    to_precision = to_decimal_type->get_precision();
146
10.2k
                    ToDataType::check_type_precision(to_precision);
147
148
10.2k
                    to_scale = to_decimal_type->get_scale();
149
10.2k
                    ToDataType::check_type_scale(to_scale);
150
10.2k
                }
151
10.2k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
10.2k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
10.2k
                    to_precision = to_max_digits;
154
10.2k
                }
155
156
10.2k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
10.2k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
10.2k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
10.2k
                if (to_scale > from_scale) {
161
10.2k
                    multiply_may_overflow &=
162
10.2k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
10.2k
                }
164
10.2k
                return narrow_integral || multiply_may_overflow;
165
10.2k
            }
166
10.2k
            return false;
167
10.2k
        });
168
10.2k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_
Line
Count
Source
104
7.57k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
7.57k
        using Types = std::decay_t<decltype(types)>;
106
7.57k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
7.57k
        return call_on_index_and_data_type<
114
7.57k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7.57k
            using Types2 = std::decay_t<decltype(types2)>;
116
7.57k
            using FromDataType = typename Types2::LeftType;
117
7.57k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
7.57k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
7.57k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
7.57k
                return false;
121
7.57k
            }
122
7.57k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
7.57k
                using FromFieldType = typename FromDataType::FieldType;
124
7.57k
                using ToFieldType = typename ToDataType::FieldType;
125
7.57k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
7.57k
                UInt32 from_scale = 0;
127
128
7.57k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
7.57k
                    const auto* from_decimal_type =
130
7.57k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
7.57k
                    from_precision =
132
7.57k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
7.57k
                    from_scale = from_decimal_type->get_scale();
134
7.57k
                }
135
136
7.57k
                UInt32 to_max_digits = 0;
137
7.57k
                UInt32 to_precision = 0;
138
7.57k
                UInt32 to_scale = 0;
139
140
7.57k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
7.57k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
7.57k
                    const auto* to_decimal_type =
144
7.57k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
7.57k
                    to_precision = to_decimal_type->get_precision();
146
7.57k
                    ToDataType::check_type_precision(to_precision);
147
148
7.57k
                    to_scale = to_decimal_type->get_scale();
149
7.57k
                    ToDataType::check_type_scale(to_scale);
150
7.57k
                }
151
7.57k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
7.57k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
7.57k
                    to_precision = to_max_digits;
154
7.57k
                }
155
156
7.57k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
7.57k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
7.57k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
7.57k
                if (to_scale > from_scale) {
161
7.57k
                    multiply_may_overflow &=
162
7.57k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
7.57k
                }
164
7.57k
                return narrow_integral || multiply_may_overflow;
165
7.57k
            }
166
7.57k
            return false;
167
7.57k
        });
168
7.57k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_
Line
Count
Source
104
30
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
30
        using Types = std::decay_t<decltype(types)>;
106
30
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
30
        return call_on_index_and_data_type<
114
30
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
30
            using Types2 = std::decay_t<decltype(types2)>;
116
30
            using FromDataType = typename Types2::LeftType;
117
30
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
30
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
30
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
30
                return false;
121
30
            }
122
30
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
30
                using FromFieldType = typename FromDataType::FieldType;
124
30
                using ToFieldType = typename ToDataType::FieldType;
125
30
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
30
                UInt32 from_scale = 0;
127
128
30
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
30
                    const auto* from_decimal_type =
130
30
                            check_and_get_data_type<FromDataType>(from_type.get());
131
30
                    from_precision =
132
30
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
30
                    from_scale = from_decimal_type->get_scale();
134
30
                }
135
136
30
                UInt32 to_max_digits = 0;
137
30
                UInt32 to_precision = 0;
138
30
                UInt32 to_scale = 0;
139
140
30
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
30
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
30
                    const auto* to_decimal_type =
144
30
                            check_and_get_data_type<ToDataType>(to_type.get());
145
30
                    to_precision = to_decimal_type->get_precision();
146
30
                    ToDataType::check_type_precision(to_precision);
147
148
30
                    to_scale = to_decimal_type->get_scale();
149
30
                    ToDataType::check_type_scale(to_scale);
150
30
                }
151
30
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
30
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
30
                    to_precision = to_max_digits;
154
30
                }
155
156
30
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
30
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
30
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
30
                if (to_scale > from_scale) {
161
30
                    multiply_may_overflow &=
162
30
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
30
                }
164
30
                return narrow_integral || multiply_may_overflow;
165
30
            }
166
30
            return false;
167
30
        });
168
30
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_
Line
Count
Source
104
6.80k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
6.80k
        using Types = std::decay_t<decltype(types)>;
106
6.80k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
6.80k
        return call_on_index_and_data_type<
114
6.80k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
6.80k
            using Types2 = std::decay_t<decltype(types2)>;
116
6.80k
            using FromDataType = typename Types2::LeftType;
117
6.80k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
6.80k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
6.80k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
6.80k
                return false;
121
6.80k
            }
122
6.80k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
6.80k
                using FromFieldType = typename FromDataType::FieldType;
124
6.80k
                using ToFieldType = typename ToDataType::FieldType;
125
6.80k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
6.80k
                UInt32 from_scale = 0;
127
128
6.80k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
6.80k
                    const auto* from_decimal_type =
130
6.80k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
6.80k
                    from_precision =
132
6.80k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
6.80k
                    from_scale = from_decimal_type->get_scale();
134
6.80k
                }
135
136
6.80k
                UInt32 to_max_digits = 0;
137
6.80k
                UInt32 to_precision = 0;
138
6.80k
                UInt32 to_scale = 0;
139
140
6.80k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
6.80k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
6.80k
                    const auto* to_decimal_type =
144
6.80k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
6.80k
                    to_precision = to_decimal_type->get_precision();
146
6.80k
                    ToDataType::check_type_precision(to_precision);
147
148
6.80k
                    to_scale = to_decimal_type->get_scale();
149
6.80k
                    ToDataType::check_type_scale(to_scale);
150
6.80k
                }
151
6.80k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
6.80k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
6.80k
                    to_precision = to_max_digits;
154
6.80k
                }
155
156
6.80k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
6.80k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
6.80k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
6.80k
                if (to_scale > from_scale) {
161
6.80k
                    multiply_may_overflow &=
162
6.80k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
6.80k
                }
164
6.80k
                return narrow_integral || multiply_may_overflow;
165
6.80k
            }
166
6.80k
            return false;
167
6.80k
        });
168
6.80k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
104
3.50k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
3.50k
        using Types = std::decay_t<decltype(types)>;
106
3.50k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
3.50k
        return call_on_index_and_data_type<
114
3.50k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3.50k
            using Types2 = std::decay_t<decltype(types2)>;
116
3.50k
            using FromDataType = typename Types2::LeftType;
117
3.50k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
3.50k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
3.50k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
3.50k
                return false;
121
3.50k
            }
122
3.50k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
3.50k
                using FromFieldType = typename FromDataType::FieldType;
124
3.50k
                using ToFieldType = typename ToDataType::FieldType;
125
3.50k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
3.50k
                UInt32 from_scale = 0;
127
128
3.50k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
3.50k
                    const auto* from_decimal_type =
130
3.50k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
3.50k
                    from_precision =
132
3.50k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
3.50k
                    from_scale = from_decimal_type->get_scale();
134
3.50k
                }
135
136
3.50k
                UInt32 to_max_digits = 0;
137
3.50k
                UInt32 to_precision = 0;
138
3.50k
                UInt32 to_scale = 0;
139
140
3.50k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
3.50k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
3.50k
                    const auto* to_decimal_type =
144
3.50k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
3.50k
                    to_precision = to_decimal_type->get_precision();
146
3.50k
                    ToDataType::check_type_precision(to_precision);
147
148
3.50k
                    to_scale = to_decimal_type->get_scale();
149
3.50k
                    ToDataType::check_type_scale(to_scale);
150
3.50k
                }
151
3.50k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
3.50k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
3.50k
                    to_precision = to_max_digits;
154
3.50k
                }
155
156
3.50k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
3.50k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
3.50k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
3.50k
                if (to_scale > from_scale) {
161
3.50k
                    multiply_may_overflow &=
162
3.50k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
3.50k
                }
164
3.50k
                return narrow_integral || multiply_may_overflow;
165
3.50k
            }
166
3.50k
            return false;
167
3.50k
        });
168
3.50k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_
Line
Count
Source
104
25
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
25
        using Types = std::decay_t<decltype(types)>;
106
25
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
25
        return call_on_index_and_data_type<
114
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
25
            using Types2 = std::decay_t<decltype(types2)>;
116
25
            using FromDataType = typename Types2::LeftType;
117
25
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
25
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
25
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
25
                return false;
121
25
            }
122
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
25
                using FromFieldType = typename FromDataType::FieldType;
124
25
                using ToFieldType = typename ToDataType::FieldType;
125
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
25
                UInt32 from_scale = 0;
127
128
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
25
                    const auto* from_decimal_type =
130
25
                            check_and_get_data_type<FromDataType>(from_type.get());
131
25
                    from_precision =
132
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
25
                    from_scale = from_decimal_type->get_scale();
134
25
                }
135
136
25
                UInt32 to_max_digits = 0;
137
25
                UInt32 to_precision = 0;
138
25
                UInt32 to_scale = 0;
139
140
25
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
25
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
25
                    const auto* to_decimal_type =
144
25
                            check_and_get_data_type<ToDataType>(to_type.get());
145
25
                    to_precision = to_decimal_type->get_precision();
146
25
                    ToDataType::check_type_precision(to_precision);
147
148
25
                    to_scale = to_decimal_type->get_scale();
149
25
                    ToDataType::check_type_scale(to_scale);
150
25
                }
151
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
25
                    to_precision = to_max_digits;
154
25
                }
155
156
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
25
                if (to_scale > from_scale) {
161
25
                    multiply_may_overflow &=
162
25
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
25
                }
164
25
                return narrow_integral || multiply_may_overflow;
165
25
            }
166
25
            return false;
167
25
        });
168
25
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_
Line
Count
Source
104
392
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
392
        using Types = std::decay_t<decltype(types)>;
106
392
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
392
        return call_on_index_and_data_type<
114
392
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
392
            using Types2 = std::decay_t<decltype(types2)>;
116
392
            using FromDataType = typename Types2::LeftType;
117
392
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
392
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
392
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
392
                return false;
121
392
            }
122
392
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
392
                using FromFieldType = typename FromDataType::FieldType;
124
392
                using ToFieldType = typename ToDataType::FieldType;
125
392
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
392
                UInt32 from_scale = 0;
127
128
392
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
392
                    const auto* from_decimal_type =
130
392
                            check_and_get_data_type<FromDataType>(from_type.get());
131
392
                    from_precision =
132
392
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
392
                    from_scale = from_decimal_type->get_scale();
134
392
                }
135
136
392
                UInt32 to_max_digits = 0;
137
392
                UInt32 to_precision = 0;
138
392
                UInt32 to_scale = 0;
139
140
392
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
392
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
392
                    const auto* to_decimal_type =
144
392
                            check_and_get_data_type<ToDataType>(to_type.get());
145
392
                    to_precision = to_decimal_type->get_precision();
146
392
                    ToDataType::check_type_precision(to_precision);
147
148
392
                    to_scale = to_decimal_type->get_scale();
149
392
                    ToDataType::check_type_scale(to_scale);
150
392
                }
151
392
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
392
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
392
                    to_precision = to_max_digits;
154
392
                }
155
156
392
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
392
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
392
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
392
                if (to_scale > from_scale) {
161
392
                    multiply_may_overflow &=
162
392
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
392
                }
164
392
                return narrow_integral || multiply_may_overflow;
165
392
            }
166
392
            return false;
167
392
        });
168
392
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_
Line
Count
Source
104
145
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
145
        using Types = std::decay_t<decltype(types)>;
106
145
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
145
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
145
            return false;
112
145
        }
113
0
        return call_on_index_and_data_type<
114
145
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
145
            using Types2 = std::decay_t<decltype(types2)>;
116
145
            using FromDataType = typename Types2::LeftType;
117
145
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
145
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
145
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
145
                return false;
121
145
            }
122
145
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
145
                using FromFieldType = typename FromDataType::FieldType;
124
145
                using ToFieldType = typename ToDataType::FieldType;
125
145
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
145
                UInt32 from_scale = 0;
127
128
145
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
145
                    const auto* from_decimal_type =
130
145
                            check_and_get_data_type<FromDataType>(from_type.get());
131
145
                    from_precision =
132
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
145
                    from_scale = from_decimal_type->get_scale();
134
145
                }
135
136
145
                UInt32 to_max_digits = 0;
137
145
                UInt32 to_precision = 0;
138
145
                UInt32 to_scale = 0;
139
140
145
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
145
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
145
                    const auto* to_decimal_type =
144
145
                            check_and_get_data_type<ToDataType>(to_type.get());
145
145
                    to_precision = to_decimal_type->get_precision();
146
145
                    ToDataType::check_type_precision(to_precision);
147
148
145
                    to_scale = to_decimal_type->get_scale();
149
145
                    ToDataType::check_type_scale(to_scale);
150
145
                }
151
145
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
145
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
145
                    to_precision = to_max_digits;
154
145
                }
155
156
145
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
145
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
145
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
145
                if (to_scale > from_scale) {
161
145
                    multiply_may_overflow &=
162
145
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
145
                }
164
145
                return narrow_integral || multiply_may_overflow;
165
145
            }
166
145
            return false;
167
145
        });
168
145
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_
Line
Count
Source
104
549
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
549
        using Types = std::decay_t<decltype(types)>;
106
549
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
549
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
549
            return false;
112
549
        }
113
0
        return call_on_index_and_data_type<
114
549
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
549
            using Types2 = std::decay_t<decltype(types2)>;
116
549
            using FromDataType = typename Types2::LeftType;
117
549
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
549
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
549
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
549
                return false;
121
549
            }
122
549
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
549
                using FromFieldType = typename FromDataType::FieldType;
124
549
                using ToFieldType = typename ToDataType::FieldType;
125
549
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
549
                UInt32 from_scale = 0;
127
128
549
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
549
                    const auto* from_decimal_type =
130
549
                            check_and_get_data_type<FromDataType>(from_type.get());
131
549
                    from_precision =
132
549
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
549
                    from_scale = from_decimal_type->get_scale();
134
549
                }
135
136
549
                UInt32 to_max_digits = 0;
137
549
                UInt32 to_precision = 0;
138
549
                UInt32 to_scale = 0;
139
140
549
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
549
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
549
                    const auto* to_decimal_type =
144
549
                            check_and_get_data_type<ToDataType>(to_type.get());
145
549
                    to_precision = to_decimal_type->get_precision();
146
549
                    ToDataType::check_type_precision(to_precision);
147
148
549
                    to_scale = to_decimal_type->get_scale();
149
549
                    ToDataType::check_type_scale(to_scale);
150
549
                }
151
549
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
549
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
549
                    to_precision = to_max_digits;
154
549
                }
155
156
549
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
549
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
549
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
549
                if (to_scale > from_scale) {
161
549
                    multiply_may_overflow &=
162
549
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
549
                }
164
549
                return narrow_integral || multiply_may_overflow;
165
549
            }
166
549
            return false;
167
549
        });
168
549
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_
Line
Count
Source
104
283
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
283
        using Types = std::decay_t<decltype(types)>;
106
283
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
283
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
283
            return false;
112
283
        }
113
0
        return call_on_index_and_data_type<
114
283
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
283
            using Types2 = std::decay_t<decltype(types2)>;
116
283
            using FromDataType = typename Types2::LeftType;
117
283
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
283
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
283
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
283
                return false;
121
283
            }
122
283
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
283
                using FromFieldType = typename FromDataType::FieldType;
124
283
                using ToFieldType = typename ToDataType::FieldType;
125
283
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
283
                UInt32 from_scale = 0;
127
128
283
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
283
                    const auto* from_decimal_type =
130
283
                            check_and_get_data_type<FromDataType>(from_type.get());
131
283
                    from_precision =
132
283
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
283
                    from_scale = from_decimal_type->get_scale();
134
283
                }
135
136
283
                UInt32 to_max_digits = 0;
137
283
                UInt32 to_precision = 0;
138
283
                UInt32 to_scale = 0;
139
140
283
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
283
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
283
                    const auto* to_decimal_type =
144
283
                            check_and_get_data_type<ToDataType>(to_type.get());
145
283
                    to_precision = to_decimal_type->get_precision();
146
283
                    ToDataType::check_type_precision(to_precision);
147
148
283
                    to_scale = to_decimal_type->get_scale();
149
283
                    ToDataType::check_type_scale(to_scale);
150
283
                }
151
283
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
283
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
283
                    to_precision = to_max_digits;
154
283
                }
155
156
283
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
283
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
283
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
283
                if (to_scale > from_scale) {
161
283
                    multiply_may_overflow &=
162
283
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
283
                }
164
283
                return narrow_integral || multiply_may_overflow;
165
283
            }
166
283
            return false;
167
283
        });
168
283
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_
Line
Count
Source
104
31.4k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
31.4k
        using Types = std::decay_t<decltype(types)>;
106
31.4k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
31.4k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
31.4k
            return false;
112
31.4k
        }
113
0
        return call_on_index_and_data_type<
114
31.4k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
31.4k
            using Types2 = std::decay_t<decltype(types2)>;
116
31.4k
            using FromDataType = typename Types2::LeftType;
117
31.4k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
31.4k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
31.4k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
31.4k
                return false;
121
31.4k
            }
122
31.4k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
31.4k
                using FromFieldType = typename FromDataType::FieldType;
124
31.4k
                using ToFieldType = typename ToDataType::FieldType;
125
31.4k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
31.4k
                UInt32 from_scale = 0;
127
128
31.4k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
31.4k
                    const auto* from_decimal_type =
130
31.4k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
31.4k
                    from_precision =
132
31.4k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
31.4k
                    from_scale = from_decimal_type->get_scale();
134
31.4k
                }
135
136
31.4k
                UInt32 to_max_digits = 0;
137
31.4k
                UInt32 to_precision = 0;
138
31.4k
                UInt32 to_scale = 0;
139
140
31.4k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
31.4k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
31.4k
                    const auto* to_decimal_type =
144
31.4k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
31.4k
                    to_precision = to_decimal_type->get_precision();
146
31.4k
                    ToDataType::check_type_precision(to_precision);
147
148
31.4k
                    to_scale = to_decimal_type->get_scale();
149
31.4k
                    ToDataType::check_type_scale(to_scale);
150
31.4k
                }
151
31.4k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
31.4k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
31.4k
                    to_precision = to_max_digits;
154
31.4k
                }
155
156
31.4k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
31.4k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
31.4k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
31.4k
                if (to_scale > from_scale) {
161
31.4k
                    multiply_may_overflow &=
162
31.4k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
31.4k
                }
164
31.4k
                return narrow_integral || multiply_may_overflow;
165
31.4k
            }
166
31.4k
            return false;
167
31.4k
        });
168
31.4k
    };
169
170
277k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
171
341k
}
172
173
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
174
363k
                                    const DataTypePtr& to_type) {
175
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
176
363k
    bool result_is_nullable = to_type->is_nullable();
177
178
363k
    if (result_is_nullable) {
179
341k
        return [from_type, to_type](FunctionContext* context, Block& block,
180
341k
                                    const ColumnNumbers& arguments, uint32_t result,
181
341k
                                    size_t input_rows_count,
182
341k
                                    const NullMap::value_type* null_map = nullptr) {
183
341k
            auto from_type_not_nullable = remove_nullable(from_type);
184
341k
            auto to_type_not_nullable = remove_nullable(to_type);
185
186
341k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
187
341k
                    context, from_type_not_nullable, to_type_not_nullable);
188
189
341k
            auto nested_result_index = block.columns();
190
341k
            block.insert(block.get_by_position(result).unnest_nullable());
191
341k
            auto nested_source_index = block.columns();
192
341k
            block.insert(block.get_by_position(arguments[0])
193
341k
                                 .unnest_nullable(replace_null_data_to_default));
194
195
341k
            const auto& arg_col = block.get_by_position(arguments[0]);
196
341k
            const NullMap::value_type* arg_null_map = nullptr;
197
341k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
198
297k
                arg_null_map = nullable->get_null_map_data().data();
199
297k
            }
200
341k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
201
341k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
202
341k
                    arg_null_map));
203
204
315k
            block.get_by_position(result).column =
205
315k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
206
315k
                                     arguments, input_rows_count);
207
208
315k
            block.erase(nested_source_index);
209
315k
            block.erase(nested_result_index);
210
315k
            return Status::OK();
211
341k
        };
212
341k
    } else {
213
22.1k
        return prepare_impl(context, from_type, to_type);
214
22.1k
    }
215
363k
}
216
217
/// 'from_type' and 'to_type' are nested types in case of Nullable.
218
/// 'requested_result_is_nullable' is true if CAST to Nullable type is requested.
219
WrapperType prepare_impl(FunctionContext* context, const DataTypePtr& origin_from_type,
220
375k
                         const DataTypePtr& origin_to_type) {
221
375k
    auto to_type = get_serialized_type(origin_to_type);
222
375k
    auto from_type = get_serialized_type(origin_from_type);
223
375k
    if (from_type->equals(*to_type)) {
224
68.7k
        return create_identity_wrapper(from_type);
225
68.7k
    }
226
227
    // variant needs to be judged first
228
306k
    if (to_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
229
11.7k
        return create_cast_to_variant_wrapper(from_type,
230
11.7k
                                              static_cast<const DataTypeVariant&>(*to_type));
231
11.7k
    }
232
294k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
233
13.8k
        return create_cast_from_variant_wrapper(static_cast<const DataTypeVariant&>(*from_type),
234
13.8k
                                                to_type);
235
13.8k
    }
236
237
281k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
238
9.34k
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
239
9.34k
                                              to_type,
240
18.4E
                                              context ? context->jsonb_string_as_string() : false);
241
9.34k
    }
242
243
271k
    switch (to_type->get_primitive_type()) {
244
925
    case PrimitiveType::TYPE_BOOLEAN:
245
925
        return create_boolean_wrapper(context, from_type);
246
3.79k
    case PrimitiveType::TYPE_TINYINT:
247
3.79k
        return create_int_wrapper<DataTypeInt8>(context, from_type);
248
5.15k
    case PrimitiveType::TYPE_SMALLINT:
249
5.15k
        return create_int_wrapper<DataTypeInt16>(context, from_type);
250
26.8k
    case PrimitiveType::TYPE_INT:
251
26.8k
        return create_int_wrapper<DataTypeInt32>(context, from_type);
252
40.2k
    case PrimitiveType::TYPE_BIGINT:
253
40.2k
        return create_int_wrapper<DataTypeInt64>(context, from_type);
254
4.09k
    case PrimitiveType::TYPE_LARGEINT:
255
4.09k
        return create_int_wrapper<DataTypeInt128>(context, from_type);
256
10.2k
    case PrimitiveType::TYPE_FLOAT:
257
10.2k
        return create_float_wrapper<DataTypeFloat32>(context, from_type);
258
24.8k
    case PrimitiveType::TYPE_DOUBLE:
259
24.8k
        return create_float_wrapper<DataTypeFloat64>(context, from_type);
260
30
    case PrimitiveType::TYPE_DATE:
261
30
        return create_datelike_wrapper<DataTypeDate>(context, from_type);
262
25
    case PrimitiveType::TYPE_DATETIME:
263
25
        return create_datelike_wrapper<DataTypeDateTime>(context, from_type);
264
6.84k
    case PrimitiveType::TYPE_DATEV2:
265
6.84k
        return create_datelike_wrapper<DataTypeDateV2>(context, from_type);
266
3.95k
    case PrimitiveType::TYPE_DATETIMEV2:
267
3.95k
        return create_datelike_wrapper<DataTypeDateTimeV2>(context, from_type);
268
145
    case PrimitiveType::TYPE_TIMESTAMPTZ:
269
145
        return create_timestamptz_wrapper(context, from_type);
270
392
    case PrimitiveType::TYPE_TIMEV2:
271
392
        return create_datelike_wrapper<DataTypeTimeV2>(context, from_type);
272
475
    case PrimitiveType::TYPE_IPV4:
273
475
        return create_ip_wrapper<DataTypeIPv4>(context, from_type);
274
284
    case PrimitiveType::TYPE_IPV6:
275
284
        return create_ip_wrapper<DataTypeIPv6>(context, from_type);
276
293
    case PrimitiveType::TYPE_DECIMALV2:
277
293
        return create_decimal_wrapper<DataTypeDecimalV2>(context, from_type);
278
6.64k
    case PrimitiveType::TYPE_DECIMAL32:
279
6.64k
        return create_decimal_wrapper<DataTypeDecimal32>(context, from_type);
280
13.5k
    case PrimitiveType::TYPE_DECIMAL64:
281
13.5k
        return create_decimal_wrapper<DataTypeDecimal64>(context, from_type);
282
11.7k
    case PrimitiveType::TYPE_DECIMAL128I:
283
11.7k
        return create_decimal_wrapper<DataTypeDecimal128>(context, from_type);
284
7.64k
    case PrimitiveType::TYPE_DECIMAL256:
285
7.64k
        return create_decimal_wrapper<DataTypeDecimal256>(context, from_type);
286
31
    case PrimitiveType::TYPE_CHAR:
287
4.31k
    case PrimitiveType::TYPE_VARCHAR:
288
28.1k
    case PrimitiveType::TYPE_STRING:
289
28.1k
        return create_string_wrapper(from_type);
290
14.0k
    case PrimitiveType::TYPE_ARRAY:
291
14.0k
        return create_array_wrapper(context, from_type,
292
14.0k
                                    static_cast<const DataTypeArray&>(*to_type));
293
1.34k
    case PrimitiveType::TYPE_STRUCT:
294
1.34k
        return create_struct_wrapper(context, from_type,
295
1.34k
                                     static_cast<const DataTypeStruct&>(*to_type));
296
952
    case PrimitiveType::TYPE_MAP:
297
952
        return create_map_wrapper(context, from_type, static_cast<const DataTypeMap&>(*to_type));
298
0
    case PrimitiveType::TYPE_HLL:
299
0
        return create_hll_wrapper(context, from_type, static_cast<const DataTypeHLL&>(*to_type));
300
1
    case PrimitiveType::TYPE_BITMAP:
301
1
        return create_bitmap_wrapper(context, from_type,
302
1
                                     static_cast<const DataTypeBitMap&>(*to_type));
303
59.0k
    case PrimitiveType::TYPE_JSONB:
304
59.0k
        return create_cast_to_jsonb_wrapper(from_type, static_cast<const DataTypeJsonb&>(*to_type),
305
59.0k
                                            context ? context->string_as_jsonb_string() : false);
306
2
    case PrimitiveType::TYPE_VARBINARY:
307
2
        return create_varbinary_wrapper(from_type);
308
0
    default:
309
0
        break;
310
271k
    }
311
312
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
313
271k
}
314
315
} // namespace CastWrapper
316
317
class PreparedFunctionCast : public PreparedFunctionImpl {
318
public:
319
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
320
354k
            : wrapper_function(std::move(wrapper_function_)), name(name_) {}
321
322
0
    String get_name() const override { return name; }
323
324
protected:
325
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
326
354k
                        uint32_t result, size_t input_rows_count) const override {
327
354k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
328
354k
    }
329
330
354k
    bool use_default_implementation_for_nulls() const override { return false; }
331
354k
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {1}; }
332
333
private:
334
    CastWrapper::WrapperType wrapper_function;
335
    const char* name;
336
};
337
338
class FunctionCast final : public IFunctionBase {
339
public:
340
    FunctionCast(const char* name_, DataTypes argument_types_, DataTypePtr return_type_)
341
271k
            : name(name_),
342
271k
              argument_types(std::move(argument_types_)),
343
271k
              return_type(std::move(return_type_)) {}
344
345
354k
    const DataTypes& get_argument_types() const override { return argument_types; }
346
354k
    const DataTypePtr& get_return_type() const override { return return_type; }
347
348
    PreparedFunctionPtr prepare(FunctionContext* context, const Block& /*sample_block*/,
349
                                const ColumnNumbers& /*arguments*/,
350
354k
                                uint32_t /*result*/) const override {
351
354k
        return std::make_shared<PreparedFunctionCast>(
352
354k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
353
354k
                                                         get_return_type()),
354
354k
                name);
355
354k
    }
356
357
0
    String get_name() const override { return name; }
358
359
0
    bool is_use_default_implementation_for_constants() const override { return true; }
360
361
private:
362
    const char* name = nullptr;
363
364
    DataTypes argument_types;
365
    DataTypePtr return_type;
366
};
367
368
class FunctionBuilderCast : public FunctionBuilderImpl {
369
public:
370
    static constexpr auto name = "CAST";
371
271k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
372
373
271k
    FunctionBuilderCast() = default;
374
375
1
    String get_name() const override { return name; }
376
377
0
    size_t get_number_of_arguments() const override { return 2; }
378
379
0
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {1}; }
380
381
protected:
382
    FunctionBasePtr build_impl(const ColumnsWithTypeAndName& arguments,
383
271k
                               const DataTypePtr& return_type) const override {
384
271k
        DataTypes data_types(arguments.size());
385
386
813k
        for (size_t i = 0; i < arguments.size(); ++i) {
387
542k
            data_types[i] = arguments[i].type;
388
542k
        }
389
390
271k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
391
271k
    }
392
393
271k
    bool skip_return_type_check() const override { return true; }
394
0
    DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override {
395
0
        return nullptr;
396
0
    }
397
398
0
    bool use_default_implementation_for_nulls() const override { return false; }
399
};
400
401
8
void register_function_cast(SimpleFunctionFactory& factory) {
402
8
    factory.register_function<FunctionBuilderCast>();
403
8
}
404
} // namespace doris