Coverage Report

Created: 2026-03-12 13:34

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
4
                               const DataTypeHLL& to_type) {
45
    /// Conversion from String through parsing.
46
4
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
47
4
        return cast_from_string_to_generic;
48
4
    }
49
50
0
    return CastWrapper::create_unsupport_wrapper("Cast to HLL only support from String type");
51
4
}
52
53
WrapperType create_bitmap_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
54
5
                                  const DataTypeBitMap& to_type) {
55
    /// Conversion from String through parsing.
56
5
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
57
5
        return cast_from_string_to_generic;
58
5
    }
59
60
0
    return CastWrapper::create_unsupport_wrapper("Cast to BitMap only support from String type");
61
5
}
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
411k
                                        const DataTypePtr& to_type) {
74
411k
    const auto& from_nested = from_type;
75
411k
    const auto& to_nested = to_type;
76
77
411k
    if (from_type->is_null_literal()) {
78
2.14k
        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
2.14k
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
84
2.14k
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
85
            /// TODO: remove this in the future.
86
2.14k
            auto& res = block.get_by_position(result);
87
2.14k
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
88
2.14k
                                 ->convert_to_full_column_if_const();
89
2.14k
            return Status::OK();
90
2.14k
        };
91
2.14k
    }
92
93
409k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
94
95
409k
    return wrapper;
96
411k
}
97
98
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
99
380k
                                       const DataTypePtr& to_type) {
100
380k
    if (from_type->equals(*to_type)) {
101
70.6k
        return false;
102
70.6k
    }
103
104
310k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
222k
        using Types = std::decay_t<decltype(types)>;
106
222k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
38.3k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
38.3k
            return false;
112
38.3k
        }
113
0
        return call_on_index_and_data_type<
114
222k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
164k
            using Types2 = std::decay_t<decltype(types2)>;
116
164k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
78.7k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
78.7k
                return false;
121
78.7k
            }
122
51.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
51.9k
                using FromFieldType = typename FromDataType::FieldType;
124
51.9k
                using ToFieldType = typename ToDataType::FieldType;
125
51.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
51.9k
                UInt32 from_scale = 0;
127
128
51.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
26.2k
                    const auto* from_decimal_type =
130
26.2k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
26.2k
                    from_precision =
132
26.2k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
26.2k
                    from_scale = from_decimal_type->get_scale();
134
26.2k
                }
135
136
51.9k
                UInt32 to_max_digits = 0;
137
51.9k
                UInt32 to_precision = 0;
138
51.9k
                UInt32 to_scale = 0;
139
140
51.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
47.2k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
47.2k
                    const auto* to_decimal_type =
144
47.2k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
47.2k
                    to_precision = to_decimal_type->get_precision();
146
47.2k
                    ToDataType::check_type_precision(to_precision);
147
148
47.2k
                    to_scale = to_decimal_type->get_scale();
149
47.2k
                    ToDataType::check_type_scale(to_scale);
150
47.2k
                }
151
51.9k
                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
51.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
51.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
51.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
51.9k
                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
51.9k
                return narrow_integral || multiply_may_overflow;
165
51.9k
            }
166
0
            return false;
167
164k
        });
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
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_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
708
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
708
            using Types2 = std::decay_t<decltype(types2)>;
116
708
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
708
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
708
                return false;
121
708
            }
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
708
            return false;
167
708
        });
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
819
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
819
            using Types2 = std::decay_t<decltype(types2)>;
116
819
            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
819
            return false;
167
819
        });
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
143
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
143
            using Types2 = std::decay_t<decltype(types2)>;
116
143
            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
143
            return false;
167
143
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
114
236
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
236
            using Types2 = std::decay_t<decltype(types2)>;
116
236
            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
236
            return false;
167
236
        });
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
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_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_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_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
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_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_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
        });
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.86k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.86k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.86k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
2.86k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
2.86k
                return false;
121
2.86k
            }
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.86k
            return false;
167
2.86k
        });
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
136
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
136
            using Types2 = std::decay_t<decltype(types2)>;
116
136
            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
136
            return false;
167
136
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
114
2.12k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.12k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.12k
            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.12k
            return false;
167
2.12k
        });
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
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
        });
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
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
        });
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
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_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.21k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.21k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.21k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
2.21k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
2.21k
                return false;
121
2.21k
            }
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.21k
            return false;
167
2.21k
        });
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
3.52k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3.52k
            using Types2 = std::decay_t<decltype(types2)>;
116
3.52k
            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.52k
            return false;
167
3.52k
        });
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
414
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
414
            using Types2 = std::decay_t<decltype(types2)>;
116
414
            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
414
            return false;
167
414
        });
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.49k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.49k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.49k
            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.49k
            return false;
167
1.49k
        });
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
130
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
130
            using Types2 = std::decay_t<decltype(types2)>;
116
130
            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
130
            return false;
167
130
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
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
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
138
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
138
                using FromFieldType = typename FromDataType::FieldType;
124
138
                using ToFieldType = typename ToDataType::FieldType;
125
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
138
                UInt32 from_scale = 0;
127
128
138
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
138
                    const auto* from_decimal_type =
130
138
                            check_and_get_data_type<FromDataType>(from_type.get());
131
138
                    from_precision =
132
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
138
                    from_scale = from_decimal_type->get_scale();
134
138
                }
135
136
138
                UInt32 to_max_digits = 0;
137
138
                UInt32 to_precision = 0;
138
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
138
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
138
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
138
                    to_precision = to_max_digits;
154
138
                }
155
156
138
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
138
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
138
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
138
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
138
                return narrow_integral || multiply_may_overflow;
165
138
            }
166
0
            return false;
167
138
        });
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
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_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.8k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
17.8k
            using Types2 = std::decay_t<decltype(types2)>;
116
17.8k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
17.8k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
17.8k
                return false;
121
17.8k
            }
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.8k
            return false;
167
17.8k
        });
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
497
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
497
            using Types2 = std::decay_t<decltype(types2)>;
116
497
            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
497
            return false;
167
497
        });
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.29k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.29k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.29k
            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.29k
            return false;
167
1.29k
        });
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
593
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
593
            using Types2 = std::decay_t<decltype(types2)>;
116
593
            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
593
            return false;
167
593
        });
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
7.54k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7.54k
            using Types2 = std::decay_t<decltype(types2)>;
116
7.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
7.54k
            return false;
167
7.54k
        });
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
291
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
291
            using Types2 = std::decay_t<decltype(types2)>;
116
291
            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
291
            return false;
167
291
        });
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
631
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
631
            using Types2 = std::decay_t<decltype(types2)>;
116
631
            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
631
            return false;
167
631
        });
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.32k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.32k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.32k
            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.32k
            return false;
167
2.32k
        });
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
312
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
312
            using Types2 = std::decay_t<decltype(types2)>;
116
312
            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
312
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
312
                using FromFieldType = typename FromDataType::FieldType;
124
312
                using ToFieldType = typename ToDataType::FieldType;
125
312
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
312
                UInt32 from_scale = 0;
127
128
312
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
312
                    const auto* from_decimal_type =
130
312
                            check_and_get_data_type<FromDataType>(from_type.get());
131
312
                    from_precision =
132
312
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
312
                    from_scale = from_decimal_type->get_scale();
134
312
                }
135
136
312
                UInt32 to_max_digits = 0;
137
312
                UInt32 to_precision = 0;
138
312
                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
312
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
312
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
312
                    to_precision = to_max_digits;
154
312
                }
155
156
312
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
312
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
312
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
312
                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
312
            }
166
0
            return false;
167
312
        });
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
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
                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
303
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
303
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
303
                    to_precision = to_max_digits;
154
303
                }
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
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
303
                return narrow_integral || multiply_may_overflow;
165
303
            }
166
0
            return false;
167
303
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
114
616
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
616
            using Types2 = std::decay_t<decltype(types2)>;
116
616
            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
616
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
616
                using FromFieldType = typename FromDataType::FieldType;
124
616
                using ToFieldType = typename ToDataType::FieldType;
125
616
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
616
                UInt32 from_scale = 0;
127
128
616
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
616
                    const auto* from_decimal_type =
130
616
                            check_and_get_data_type<FromDataType>(from_type.get());
131
616
                    from_precision =
132
616
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
616
                    from_scale = from_decimal_type->get_scale();
134
616
                }
135
136
616
                UInt32 to_max_digits = 0;
137
616
                UInt32 to_precision = 0;
138
616
                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
616
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
616
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
616
                    to_precision = to_max_digits;
154
616
                }
155
156
616
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
616
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
616
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
616
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
616
                return narrow_integral || multiply_may_overflow;
165
616
            }
166
0
            return false;
167
616
        });
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
19.5k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
19.5k
            using Types2 = std::decay_t<decltype(types2)>;
116
19.5k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
19.5k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
19.5k
                return false;
121
19.5k
            }
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.5k
            return false;
167
19.5k
        });
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
136
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
136
            using Types2 = std::decay_t<decltype(types2)>;
116
136
            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
136
            return false;
167
136
        });
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
558
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
558
            using Types2 = std::decay_t<decltype(types2)>;
116
558
            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
558
            return false;
167
558
        });
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.90k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.90k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.90k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
1.90k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1.90k
                return false;
121
1.90k
            }
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.90k
            return false;
167
1.90k
        });
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
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
            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
63
            return false;
167
63
        });
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.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
1.26k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1.26k
                return false;
121
1.26k
            }
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
        });
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
419
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
419
            using Types2 = std::decay_t<decltype(types2)>;
116
419
            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
419
            return false;
167
419
        });
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
460
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
460
            using Types2 = std::decay_t<decltype(types2)>;
116
460
            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
460
            return false;
167
460
        });
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.05k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.05k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.05k
            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.05k
            return false;
167
1.05k
        });
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.44k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.44k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.44k
            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.44k
            return false;
167
1.44k
        });
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.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
        });
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
457
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
457
            using Types2 = std::decay_t<decltype(types2)>;
116
457
            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
457
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
457
                using FromFieldType = typename FromDataType::FieldType;
124
457
                using ToFieldType = typename ToDataType::FieldType;
125
457
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
457
                UInt32 from_scale = 0;
127
128
457
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
457
                    const auto* from_decimal_type =
130
457
                            check_and_get_data_type<FromDataType>(from_type.get());
131
457
                    from_precision =
132
457
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
457
                    from_scale = from_decimal_type->get_scale();
134
457
                }
135
136
457
                UInt32 to_max_digits = 0;
137
457
                UInt32 to_precision = 0;
138
457
                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
457
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
457
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
457
                    to_precision = to_max_digits;
154
457
                }
155
156
457
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
457
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
457
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
457
                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
457
            }
166
0
            return false;
167
457
        });
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
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
                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
317
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
317
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
317
                    to_precision = to_max_digits;
154
317
                }
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
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
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_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
436
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
436
            using Types2 = std::decay_t<decltype(types2)>;
116
436
            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
436
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
436
                using FromFieldType = typename FromDataType::FieldType;
124
436
                using ToFieldType = typename ToDataType::FieldType;
125
436
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
436
                UInt32 from_scale = 0;
127
128
436
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
436
                    const auto* from_decimal_type =
130
436
                            check_and_get_data_type<FromDataType>(from_type.get());
131
436
                    from_precision =
132
436
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
436
                    from_scale = from_decimal_type->get_scale();
134
436
                }
135
136
436
                UInt32 to_max_digits = 0;
137
436
                UInt32 to_precision = 0;
138
436
                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
436
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
436
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
436
                    to_precision = to_max_digits;
154
436
                }
155
156
436
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
436
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
436
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
436
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
436
                return narrow_integral || multiply_may_overflow;
165
436
            }
166
0
            return false;
167
436
        });
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
286
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
286
            using Types2 = std::decay_t<decltype(types2)>;
116
286
            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
286
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
286
                using FromFieldType = typename FromDataType::FieldType;
124
286
                using ToFieldType = typename ToDataType::FieldType;
125
286
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
286
                UInt32 from_scale = 0;
127
128
286
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
286
                    const auto* from_decimal_type =
130
286
                            check_and_get_data_type<FromDataType>(from_type.get());
131
286
                    from_precision =
132
286
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
286
                    from_scale = from_decimal_type->get_scale();
134
286
                }
135
136
286
                UInt32 to_max_digits = 0;
137
286
                UInt32 to_precision = 0;
138
286
                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
286
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
286
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
286
                    to_precision = to_max_digits;
154
286
                }
155
156
286
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
286
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
286
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
286
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
286
                return narrow_integral || multiply_may_overflow;
165
286
            }
166
0
            return false;
167
286
        });
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
202
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
202
            using Types2 = std::decay_t<decltype(types2)>;
116
202
            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
202
            return false;
167
202
        });
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.96k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7.96k
            using Types2 = std::decay_t<decltype(types2)>;
116
7.96k
            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.96k
            return false;
167
7.96k
        });
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
6.64k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
6.64k
            using Types2 = std::decay_t<decltype(types2)>;
116
6.64k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
6.64k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
6.64k
                return false;
121
6.64k
            }
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.64k
            return false;
167
6.64k
        });
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
408
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
408
            using Types2 = std::decay_t<decltype(types2)>;
116
408
            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
408
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
408
                using FromFieldType = typename FromDataType::FieldType;
124
408
                using ToFieldType = typename ToDataType::FieldType;
125
408
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
408
                UInt32 from_scale = 0;
127
128
408
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
408
                    const auto* from_decimal_type =
130
408
                            check_and_get_data_type<FromDataType>(from_type.get());
131
408
                    from_precision =
132
408
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
408
                    from_scale = from_decimal_type->get_scale();
134
408
                }
135
136
408
                UInt32 to_max_digits = 0;
137
408
                UInt32 to_precision = 0;
138
408
                UInt32 to_scale = 0;
139
140
408
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
408
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
408
                    const auto* to_decimal_type =
144
408
                            check_and_get_data_type<ToDataType>(to_type.get());
145
408
                    to_precision = to_decimal_type->get_precision();
146
408
                    ToDataType::check_type_precision(to_precision);
147
148
408
                    to_scale = to_decimal_type->get_scale();
149
408
                    ToDataType::check_type_scale(to_scale);
150
408
                }
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
408
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
408
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
408
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
408
                if (to_scale > from_scale) {
161
81
                    multiply_may_overflow &=
162
81
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
81
                }
164
408
                return narrow_integral || multiply_may_overflow;
165
408
            }
166
0
            return false;
167
408
        });
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
620
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
620
            using Types2 = std::decay_t<decltype(types2)>;
116
620
            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
620
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
620
                using FromFieldType = typename FromDataType::FieldType;
124
620
                using ToFieldType = typename ToDataType::FieldType;
125
620
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
620
                UInt32 from_scale = 0;
127
128
620
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
620
                    const auto* from_decimal_type =
130
620
                            check_and_get_data_type<FromDataType>(from_type.get());
131
620
                    from_precision =
132
620
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
620
                    from_scale = from_decimal_type->get_scale();
134
620
                }
135
136
620
                UInt32 to_max_digits = 0;
137
620
                UInt32 to_precision = 0;
138
620
                UInt32 to_scale = 0;
139
140
620
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
620
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
620
                    const auto* to_decimal_type =
144
620
                            check_and_get_data_type<ToDataType>(to_type.get());
145
620
                    to_precision = to_decimal_type->get_precision();
146
620
                    ToDataType::check_type_precision(to_precision);
147
148
620
                    to_scale = to_decimal_type->get_scale();
149
620
                    ToDataType::check_type_scale(to_scale);
150
620
                }
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
620
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
620
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
620
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
620
                if (to_scale > from_scale) {
161
198
                    multiply_may_overflow &=
162
198
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
198
                }
164
620
                return narrow_integral || multiply_may_overflow;
165
620
            }
166
0
            return false;
167
620
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
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
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
139
                    multiply_may_overflow &=
162
139
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
139
                }
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_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.53k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.53k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.53k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
2.53k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
2.53k
                return false;
121
2.53k
            }
122
2.53k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
2.53k
                using FromFieldType = typename FromDataType::FieldType;
124
2.53k
                using ToFieldType = typename ToDataType::FieldType;
125
2.53k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
2.53k
                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.53k
                UInt32 to_max_digits = 0;
137
2.53k
                UInt32 to_precision = 0;
138
2.53k
                UInt32 to_scale = 0;
139
140
2.53k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
2.53k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
2.53k
                    const auto* to_decimal_type =
144
2.53k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
2.53k
                    to_precision = to_decimal_type->get_precision();
146
2.53k
                    ToDataType::check_type_precision(to_precision);
147
148
2.53k
                    to_scale = to_decimal_type->get_scale();
149
2.53k
                    ToDataType::check_type_scale(to_scale);
150
2.53k
                }
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.53k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
2.53k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
2.53k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
2.53k
                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.53k
                return narrow_integral || multiply_may_overflow;
165
2.53k
            }
166
0
            return false;
167
2.53k
        });
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
71
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
71
            using Types2 = std::decay_t<decltype(types2)>;
116
71
            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
71
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
71
                using FromFieldType = typename FromDataType::FieldType;
124
71
                using ToFieldType = typename ToDataType::FieldType;
125
71
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
71
                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
71
                UInt32 to_max_digits = 0;
137
71
                UInt32 to_precision = 0;
138
71
                UInt32 to_scale = 0;
139
140
71
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
71
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
71
                    const auto* to_decimal_type =
144
71
                            check_and_get_data_type<ToDataType>(to_type.get());
145
71
                    to_precision = to_decimal_type->get_precision();
146
71
                    ToDataType::check_type_precision(to_precision);
147
148
71
                    to_scale = to_decimal_type->get_scale();
149
71
                    ToDataType::check_type_scale(to_scale);
150
71
                }
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
71
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
71
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
71
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
71
                if (to_scale > from_scale) {
161
59
                    multiply_may_overflow &=
162
59
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
59
                }
164
71
                return narrow_integral || multiply_may_overflow;
165
71
            }
166
0
            return false;
167
71
        });
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
468
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
468
            using Types2 = std::decay_t<decltype(types2)>;
116
468
            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
468
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
468
                using FromFieldType = typename FromDataType::FieldType;
124
468
                using ToFieldType = typename ToDataType::FieldType;
125
468
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
468
                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
468
                UInt32 to_max_digits = 0;
137
468
                UInt32 to_precision = 0;
138
468
                UInt32 to_scale = 0;
139
140
468
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
468
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
468
                    const auto* to_decimal_type =
144
468
                            check_and_get_data_type<ToDataType>(to_type.get());
145
468
                    to_precision = to_decimal_type->get_precision();
146
468
                    ToDataType::check_type_precision(to_precision);
147
148
468
                    to_scale = to_decimal_type->get_scale();
149
468
                    ToDataType::check_type_scale(to_scale);
150
468
                }
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
468
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
468
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
468
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
468
                if (to_scale > from_scale) {
161
315
                    multiply_may_overflow &=
162
315
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
315
                }
164
468
                return narrow_integral || multiply_may_overflow;
165
468
            }
166
0
            return false;
167
468
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
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
10.1k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
10.1k
            using Types2 = std::decay_t<decltype(types2)>;
116
10.1k
            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.1k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
10.1k
                using FromFieldType = typename FromDataType::FieldType;
124
10.1k
                using ToFieldType = typename ToDataType::FieldType;
125
10.1k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
10.1k
                UInt32 from_scale = 0;
127
128
10.1k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
10.1k
                    const auto* from_decimal_type =
130
10.1k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
10.1k
                    from_precision =
132
10.1k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
10.1k
                    from_scale = from_decimal_type->get_scale();
134
10.1k
                }
135
136
10.1k
                UInt32 to_max_digits = 0;
137
10.1k
                UInt32 to_precision = 0;
138
10.1k
                UInt32 to_scale = 0;
139
140
10.1k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
10.1k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
10.1k
                    const auto* to_decimal_type =
144
10.1k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
10.1k
                    to_precision = to_decimal_type->get_precision();
146
10.1k
                    ToDataType::check_type_precision(to_precision);
147
148
10.1k
                    to_scale = to_decimal_type->get_scale();
149
10.1k
                    ToDataType::check_type_scale(to_scale);
150
10.1k
                }
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
10.1k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
10.1k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
10.1k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
10.1k
                if (to_scale > from_scale) {
161
158
                    multiply_may_overflow &=
162
158
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
158
                }
164
10.1k
                return narrow_integral || multiply_may_overflow;
165
10.1k
            }
166
0
            return false;
167
10.1k
        });
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
425
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
425
            using Types2 = std::decay_t<decltype(types2)>;
116
425
            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
425
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
425
                using FromFieldType = typename FromDataType::FieldType;
124
425
                using ToFieldType = typename ToDataType::FieldType;
125
425
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
425
                UInt32 from_scale = 0;
127
128
425
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
425
                    const auto* from_decimal_type =
130
425
                            check_and_get_data_type<FromDataType>(from_type.get());
131
425
                    from_precision =
132
425
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
425
                    from_scale = from_decimal_type->get_scale();
134
425
                }
135
136
425
                UInt32 to_max_digits = 0;
137
425
                UInt32 to_precision = 0;
138
425
                UInt32 to_scale = 0;
139
140
425
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
425
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
425
                    const auto* to_decimal_type =
144
425
                            check_and_get_data_type<ToDataType>(to_type.get());
145
425
                    to_precision = to_decimal_type->get_precision();
146
425
                    ToDataType::check_type_precision(to_precision);
147
148
425
                    to_scale = to_decimal_type->get_scale();
149
425
                    ToDataType::check_type_scale(to_scale);
150
425
                }
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
425
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
425
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
425
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
425
                if (to_scale > from_scale) {
161
144
                    multiply_may_overflow &=
162
144
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
144
                }
164
425
                return narrow_integral || multiply_may_overflow;
165
425
            }
166
0
            return false;
167
425
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Line
Count
Source
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.63k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
6.63k
            using Types2 = std::decay_t<decltype(types2)>;
116
6.63k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
6.63k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
6.63k
                return false;
121
6.63k
            }
122
6.63k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
6.63k
                using FromFieldType = typename FromDataType::FieldType;
124
6.63k
                using ToFieldType = typename ToDataType::FieldType;
125
6.63k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
6.63k
                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.63k
                UInt32 to_max_digits = 0;
137
6.63k
                UInt32 to_precision = 0;
138
6.63k
                UInt32 to_scale = 0;
139
140
6.63k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
6.63k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
6.63k
                    const auto* to_decimal_type =
144
6.63k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
6.63k
                    to_precision = to_decimal_type->get_precision();
146
6.63k
                    ToDataType::check_type_precision(to_precision);
147
148
6.63k
                    to_scale = to_decimal_type->get_scale();
149
6.63k
                    ToDataType::check_type_scale(to_scale);
150
6.63k
                }
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.63k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
6.63k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
6.63k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
6.63k
                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.63k
                return narrow_integral || multiply_may_overflow;
165
6.63k
            }
166
0
            return false;
167
6.63k
        });
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
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
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
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
                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
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
                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
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
354
                    multiply_may_overflow &=
162
354
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
354
                }
164
392
                return narrow_integral || multiply_may_overflow;
165
392
            }
166
0
            return false;
167
392
        });
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
2.53k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.53k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.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
2.53k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
2.53k
                using FromFieldType = typename FromDataType::FieldType;
124
2.53k
                using ToFieldType = typename ToDataType::FieldType;
125
2.53k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
2.53k
                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.53k
                UInt32 to_max_digits = 0;
137
2.53k
                UInt32 to_precision = 0;
138
2.53k
                UInt32 to_scale = 0;
139
140
2.53k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
2.53k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
2.53k
                    const auto* to_decimal_type =
144
2.53k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
2.53k
                    to_precision = to_decimal_type->get_precision();
146
2.53k
                    ToDataType::check_type_precision(to_precision);
147
148
2.53k
                    to_scale = to_decimal_type->get_scale();
149
2.53k
                    ToDataType::check_type_scale(to_scale);
150
2.53k
                }
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.53k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
2.53k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
2.53k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
2.53k
                if (to_scale > from_scale) {
161
619
                    multiply_may_overflow &=
162
619
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
619
                }
164
2.53k
                return narrow_integral || multiply_may_overflow;
165
2.53k
            }
166
0
            return false;
167
2.53k
        });
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
448
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
448
            using Types2 = std::decay_t<decltype(types2)>;
116
448
            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
448
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
448
                using FromFieldType = typename FromDataType::FieldType;
124
448
                using ToFieldType = typename ToDataType::FieldType;
125
448
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
448
                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
448
                UInt32 to_max_digits = 0;
137
448
                UInt32 to_precision = 0;
138
448
                UInt32 to_scale = 0;
139
140
448
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
448
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
448
                    const auto* to_decimal_type =
144
448
                            check_and_get_data_type<ToDataType>(to_type.get());
145
448
                    to_precision = to_decimal_type->get_precision();
146
448
                    ToDataType::check_type_precision(to_precision);
147
148
448
                    to_scale = to_decimal_type->get_scale();
149
448
                    ToDataType::check_type_scale(to_scale);
150
448
                }
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
448
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
448
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
448
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
448
                if (to_scale > from_scale) {
161
368
                    multiply_may_overflow &=
162
368
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
368
                }
164
448
                return narrow_integral || multiply_may_overflow;
165
448
            }
166
0
            return false;
167
448
        });
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
799
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
799
            using Types2 = std::decay_t<decltype(types2)>;
116
799
            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
799
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
799
                using FromFieldType = typename FromDataType::FieldType;
124
799
                using ToFieldType = typename ToDataType::FieldType;
125
799
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
799
                UInt32 from_scale = 0;
127
128
799
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
799
                    const auto* from_decimal_type =
130
799
                            check_and_get_data_type<FromDataType>(from_type.get());
131
799
                    from_precision =
132
799
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
799
                    from_scale = from_decimal_type->get_scale();
134
799
                }
135
136
799
                UInt32 to_max_digits = 0;
137
799
                UInt32 to_precision = 0;
138
799
                UInt32 to_scale = 0;
139
140
799
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
799
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
799
                    const auto* to_decimal_type =
144
799
                            check_and_get_data_type<ToDataType>(to_type.get());
145
799
                    to_precision = to_decimal_type->get_precision();
146
799
                    ToDataType::check_type_precision(to_precision);
147
148
799
                    to_scale = to_decimal_type->get_scale();
149
799
                    ToDataType::check_type_scale(to_scale);
150
799
                }
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
799
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
799
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
799
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
799
                if (to_scale > from_scale) {
161
471
                    multiply_may_overflow &=
162
471
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
471
                }
164
799
                return narrow_integral || multiply_may_overflow;
165
799
            }
166
0
            return false;
167
799
        });
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.97k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.97k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.97k
            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.97k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1.97k
                using FromFieldType = typename FromDataType::FieldType;
124
1.97k
                using ToFieldType = typename ToDataType::FieldType;
125
1.97k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1.97k
                UInt32 from_scale = 0;
127
128
1.97k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
1.97k
                    const auto* from_decimal_type =
130
1.97k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
1.97k
                    from_precision =
132
1.97k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
1.97k
                    from_scale = from_decimal_type->get_scale();
134
1.97k
                }
135
136
1.97k
                UInt32 to_max_digits = 0;
137
1.97k
                UInt32 to_precision = 0;
138
1.97k
                UInt32 to_scale = 0;
139
140
1.97k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1.97k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1.97k
                    const auto* to_decimal_type =
144
1.97k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1.97k
                    to_precision = to_decimal_type->get_precision();
146
1.97k
                    ToDataType::check_type_precision(to_precision);
147
148
1.97k
                    to_scale = to_decimal_type->get_scale();
149
1.97k
                    ToDataType::check_type_scale(to_scale);
150
1.97k
                }
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.97k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1.97k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1.97k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1.97k
                if (to_scale > from_scale) {
161
554
                    multiply_may_overflow &=
162
554
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
554
                }
164
1.97k
                return narrow_integral || multiply_may_overflow;
165
1.97k
            }
166
0
            return false;
167
1.97k
        });
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
4.22k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
4.22k
            using Types2 = std::decay_t<decltype(types2)>;
116
4.22k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
4.22k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
4.22k
                return false;
121
4.22k
            }
122
4.22k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
4.22k
                using FromFieldType = typename FromDataType::FieldType;
124
4.22k
                using ToFieldType = typename ToDataType::FieldType;
125
4.22k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
4.22k
                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
4.22k
                UInt32 to_max_digits = 0;
137
4.22k
                UInt32 to_precision = 0;
138
4.22k
                UInt32 to_scale = 0;
139
140
4.22k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
4.22k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
4.22k
                    const auto* to_decimal_type =
144
4.22k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
4.22k
                    to_precision = to_decimal_type->get_precision();
146
4.22k
                    ToDataType::check_type_precision(to_precision);
147
148
4.22k
                    to_scale = to_decimal_type->get_scale();
149
4.22k
                    ToDataType::check_type_scale(to_scale);
150
4.22k
                }
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
4.22k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
4.22k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
4.22k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
4.22k
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
4.22k
                return narrow_integral || multiply_may_overflow;
165
4.22k
            }
166
0
            return false;
167
4.22k
        });
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
275
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
275
            using Types2 = std::decay_t<decltype(types2)>;
116
275
            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
275
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
275
                using FromFieldType = typename FromDataType::FieldType;
124
275
                using ToFieldType = typename ToDataType::FieldType;
125
275
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
275
                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
275
                UInt32 to_max_digits = 0;
137
275
                UInt32 to_precision = 0;
138
275
                UInt32 to_scale = 0;
139
140
275
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
275
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
275
                    const auto* to_decimal_type =
144
275
                            check_and_get_data_type<ToDataType>(to_type.get());
145
275
                    to_precision = to_decimal_type->get_precision();
146
275
                    ToDataType::check_type_precision(to_precision);
147
148
275
                    to_scale = to_decimal_type->get_scale();
149
275
                    ToDataType::check_type_scale(to_scale);
150
275
                }
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
275
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
275
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
275
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
275
                if (to_scale > from_scale) {
161
196
                    multiply_may_overflow &=
162
196
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
196
                }
164
275
                return narrow_integral || multiply_may_overflow;
165
275
            }
166
0
            return false;
167
275
        });
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
960
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
960
            using Types2 = std::decay_t<decltype(types2)>;
116
960
            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
960
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
960
                using FromFieldType = typename FromDataType::FieldType;
124
960
                using ToFieldType = typename ToDataType::FieldType;
125
960
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
960
                UInt32 from_scale = 0;
127
128
960
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
960
                    const auto* from_decimal_type =
130
960
                            check_and_get_data_type<FromDataType>(from_type.get());
131
960
                    from_precision =
132
960
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
960
                    from_scale = from_decimal_type->get_scale();
134
960
                }
135
136
960
                UInt32 to_max_digits = 0;
137
960
                UInt32 to_precision = 0;
138
960
                UInt32 to_scale = 0;
139
140
960
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
960
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
960
                    const auto* to_decimal_type =
144
960
                            check_and_get_data_type<ToDataType>(to_type.get());
145
960
                    to_precision = to_decimal_type->get_precision();
146
960
                    ToDataType::check_type_precision(to_precision);
147
148
960
                    to_scale = to_decimal_type->get_scale();
149
960
                    ToDataType::check_type_scale(to_scale);
150
960
                }
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
960
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
960
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
960
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
960
                if (to_scale > from_scale) {
161
506
                    multiply_may_overflow &=
162
506
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
506
                }
164
960
                return narrow_integral || multiply_may_overflow;
165
960
            }
166
0
            return false;
167
960
        });
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
680
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
680
            using Types2 = std::decay_t<decltype(types2)>;
116
680
            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
680
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
680
                using FromFieldType = typename FromDataType::FieldType;
124
680
                using ToFieldType = typename ToDataType::FieldType;
125
680
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
680
                UInt32 from_scale = 0;
127
128
680
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
680
                    const auto* from_decimal_type =
130
680
                            check_and_get_data_type<FromDataType>(from_type.get());
131
680
                    from_precision =
132
680
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
680
                    from_scale = from_decimal_type->get_scale();
134
680
                }
135
136
680
                UInt32 to_max_digits = 0;
137
680
                UInt32 to_precision = 0;
138
680
                UInt32 to_scale = 0;
139
140
680
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
680
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
680
                    const auto* to_decimal_type =
144
680
                            check_and_get_data_type<ToDataType>(to_type.get());
145
680
                    to_precision = to_decimal_type->get_precision();
146
680
                    ToDataType::check_type_precision(to_precision);
147
148
680
                    to_scale = to_decimal_type->get_scale();
149
680
                    ToDataType::check_type_scale(to_scale);
150
680
                }
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
680
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
680
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
680
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
680
                if (to_scale > from_scale) {
161
333
                    multiply_may_overflow &=
162
333
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
333
                }
164
680
                return narrow_integral || multiply_may_overflow;
165
680
            }
166
0
            return false;
167
680
        });
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.56k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3.56k
            using Types2 = std::decay_t<decltype(types2)>;
116
3.56k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
3.56k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
3.56k
                return false;
121
3.56k
            }
122
3.56k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
3.56k
                using FromFieldType = typename FromDataType::FieldType;
124
3.56k
                using ToFieldType = typename ToDataType::FieldType;
125
3.56k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
3.56k
                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.56k
                UInt32 to_max_digits = 0;
137
3.56k
                UInt32 to_precision = 0;
138
3.56k
                UInt32 to_scale = 0;
139
140
3.56k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
3.56k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
3.56k
                    const auto* to_decimal_type =
144
3.56k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
3.56k
                    to_precision = to_decimal_type->get_precision();
146
3.56k
                    ToDataType::check_type_precision(to_precision);
147
148
3.56k
                    to_scale = to_decimal_type->get_scale();
149
3.56k
                    ToDataType::check_type_scale(to_scale);
150
3.56k
                }
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.56k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
3.56k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
3.56k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
3.56k
                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.56k
                return narrow_integral || multiply_may_overflow;
165
3.56k
            }
166
0
            return false;
167
3.56k
        });
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
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
        });
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
222
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
222
            using Types2 = std::decay_t<decltype(types2)>;
116
222
            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
222
            return false;
167
222
        });
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.44k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
5.44k
            using Types2 = std::decay_t<decltype(types2)>;
116
5.44k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
5.44k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
5.44k
                return false;
121
5.44k
            }
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.44k
            return false;
167
5.44k
        });
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
405
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
405
            using Types2 = std::decay_t<decltype(types2)>;
116
405
            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
405
            return false;
167
405
        });
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
111
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
111
            using Types2 = std::decay_t<decltype(types2)>;
116
111
            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
111
            return false;
167
111
        });
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
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_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.96k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.96k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.96k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
2.96k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
2.96k
                return false;
121
2.96k
            }
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.96k
            return false;
167
2.96k
        });
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
222k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
104
2.37k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
2.37k
        using Types = std::decay_t<decltype(types)>;
106
2.37k
        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.37k
        return call_on_index_and_data_type<
114
2.37k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.37k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.37k
            using FromDataType = typename Types2::LeftType;
117
2.37k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
2.37k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
2.37k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
2.37k
                return false;
121
2.37k
            }
122
2.37k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
2.37k
                using FromFieldType = typename FromDataType::FieldType;
124
2.37k
                using ToFieldType = typename ToDataType::FieldType;
125
2.37k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
2.37k
                UInt32 from_scale = 0;
127
128
2.37k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
2.37k
                    const auto* from_decimal_type =
130
2.37k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
2.37k
                    from_precision =
132
2.37k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
2.37k
                    from_scale = from_decimal_type->get_scale();
134
2.37k
                }
135
136
2.37k
                UInt32 to_max_digits = 0;
137
2.37k
                UInt32 to_precision = 0;
138
2.37k
                UInt32 to_scale = 0;
139
140
2.37k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
2.37k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
2.37k
                    const auto* to_decimal_type =
144
2.37k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
2.37k
                    to_precision = to_decimal_type->get_precision();
146
2.37k
                    ToDataType::check_type_precision(to_precision);
147
148
2.37k
                    to_scale = to_decimal_type->get_scale();
149
2.37k
                    ToDataType::check_type_scale(to_scale);
150
2.37k
                }
151
2.37k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
2.37k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
2.37k
                    to_precision = to_max_digits;
154
2.37k
                }
155
156
2.37k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
2.37k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
2.37k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
2.37k
                if (to_scale > from_scale) {
161
2.37k
                    multiply_may_overflow &=
162
2.37k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
2.37k
                }
164
2.37k
                return narrow_integral || multiply_may_overflow;
165
2.37k
            }
166
2.37k
            return false;
167
2.37k
        });
168
2.37k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
104
4.72k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
4.72k
        using Types = std::decay_t<decltype(types)>;
106
4.72k
        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.72k
        return call_on_index_and_data_type<
114
4.72k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
4.72k
            using Types2 = std::decay_t<decltype(types2)>;
116
4.72k
            using FromDataType = typename Types2::LeftType;
117
4.72k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
4.72k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
4.72k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
4.72k
                return false;
121
4.72k
            }
122
4.72k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
4.72k
                using FromFieldType = typename FromDataType::FieldType;
124
4.72k
                using ToFieldType = typename ToDataType::FieldType;
125
4.72k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
4.72k
                UInt32 from_scale = 0;
127
128
4.72k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
4.72k
                    const auto* from_decimal_type =
130
4.72k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
4.72k
                    from_precision =
132
4.72k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
4.72k
                    from_scale = from_decimal_type->get_scale();
134
4.72k
                }
135
136
4.72k
                UInt32 to_max_digits = 0;
137
4.72k
                UInt32 to_precision = 0;
138
4.72k
                UInt32 to_scale = 0;
139
140
4.72k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
4.72k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
4.72k
                    const auto* to_decimal_type =
144
4.72k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
4.72k
                    to_precision = to_decimal_type->get_precision();
146
4.72k
                    ToDataType::check_type_precision(to_precision);
147
148
4.72k
                    to_scale = to_decimal_type->get_scale();
149
4.72k
                    ToDataType::check_type_scale(to_scale);
150
4.72k
                }
151
4.72k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
4.72k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
4.72k
                    to_precision = to_max_digits;
154
4.72k
                }
155
156
4.72k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
4.72k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
4.72k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
4.72k
                if (to_scale > from_scale) {
161
4.72k
                    multiply_may_overflow &=
162
4.72k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
4.72k
                }
164
4.72k
                return narrow_integral || multiply_may_overflow;
165
4.72k
            }
166
4.72k
            return false;
167
4.72k
        });
168
4.72k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
104
5.43k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
5.43k
        using Types = std::decay_t<decltype(types)>;
106
5.43k
        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.43k
        return call_on_index_and_data_type<
114
5.43k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
5.43k
            using Types2 = std::decay_t<decltype(types2)>;
116
5.43k
            using FromDataType = typename Types2::LeftType;
117
5.43k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
5.43k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
5.43k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
5.43k
                return false;
121
5.43k
            }
122
5.43k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
5.43k
                using FromFieldType = typename FromDataType::FieldType;
124
5.43k
                using ToFieldType = typename ToDataType::FieldType;
125
5.43k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
5.43k
                UInt32 from_scale = 0;
127
128
5.43k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
5.43k
                    const auto* from_decimal_type =
130
5.43k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
5.43k
                    from_precision =
132
5.43k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
5.43k
                    from_scale = from_decimal_type->get_scale();
134
5.43k
                }
135
136
5.43k
                UInt32 to_max_digits = 0;
137
5.43k
                UInt32 to_precision = 0;
138
5.43k
                UInt32 to_scale = 0;
139
140
5.43k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
5.43k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
5.43k
                    const auto* to_decimal_type =
144
5.43k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
5.43k
                    to_precision = to_decimal_type->get_precision();
146
5.43k
                    ToDataType::check_type_precision(to_precision);
147
148
5.43k
                    to_scale = to_decimal_type->get_scale();
149
5.43k
                    ToDataType::check_type_scale(to_scale);
150
5.43k
                }
151
5.43k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
5.43k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
5.43k
                    to_precision = to_max_digits;
154
5.43k
                }
155
156
5.43k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
5.43k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
5.43k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
5.43k
                if (to_scale > from_scale) {
161
5.43k
                    multiply_may_overflow &=
162
5.43k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
5.43k
                }
164
5.43k
                return narrow_integral || multiply_may_overflow;
165
5.43k
            }
166
5.43k
            return false;
167
5.43k
        });
168
5.43k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
104
34.6k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
34.6k
        using Types = std::decay_t<decltype(types)>;
106
34.6k
        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.6k
        return call_on_index_and_data_type<
114
34.6k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
34.6k
            using Types2 = std::decay_t<decltype(types2)>;
116
34.6k
            using FromDataType = typename Types2::LeftType;
117
34.6k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
34.6k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
34.6k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
34.6k
                return false;
121
34.6k
            }
122
34.6k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
34.6k
                using FromFieldType = typename FromDataType::FieldType;
124
34.6k
                using ToFieldType = typename ToDataType::FieldType;
125
34.6k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
34.6k
                UInt32 from_scale = 0;
127
128
34.6k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
34.6k
                    const auto* from_decimal_type =
130
34.6k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
34.6k
                    from_precision =
132
34.6k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
34.6k
                    from_scale = from_decimal_type->get_scale();
134
34.6k
                }
135
136
34.6k
                UInt32 to_max_digits = 0;
137
34.6k
                UInt32 to_precision = 0;
138
34.6k
                UInt32 to_scale = 0;
139
140
34.6k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
34.6k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
34.6k
                    const auto* to_decimal_type =
144
34.6k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
34.6k
                    to_precision = to_decimal_type->get_precision();
146
34.6k
                    ToDataType::check_type_precision(to_precision);
147
148
34.6k
                    to_scale = to_decimal_type->get_scale();
149
34.6k
                    ToDataType::check_type_scale(to_scale);
150
34.6k
                }
151
34.6k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
34.6k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
34.6k
                    to_precision = to_max_digits;
154
34.6k
                }
155
156
34.6k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
34.6k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
34.6k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
34.6k
                if (to_scale > from_scale) {
161
34.6k
                    multiply_may_overflow &=
162
34.6k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
34.6k
                }
164
34.6k
                return narrow_integral || multiply_may_overflow;
165
34.6k
            }
166
34.6k
            return false;
167
34.6k
        });
168
34.6k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
104
38.5k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
38.5k
        using Types = std::decay_t<decltype(types)>;
106
38.5k
        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
38.5k
        return call_on_index_and_data_type<
114
38.5k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
38.5k
            using Types2 = std::decay_t<decltype(types2)>;
116
38.5k
            using FromDataType = typename Types2::LeftType;
117
38.5k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
38.5k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
38.5k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
38.5k
                return false;
121
38.5k
            }
122
38.5k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
38.5k
                using FromFieldType = typename FromDataType::FieldType;
124
38.5k
                using ToFieldType = typename ToDataType::FieldType;
125
38.5k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
38.5k
                UInt32 from_scale = 0;
127
128
38.5k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
38.5k
                    const auto* from_decimal_type =
130
38.5k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
38.5k
                    from_precision =
132
38.5k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
38.5k
                    from_scale = from_decimal_type->get_scale();
134
38.5k
                }
135
136
38.5k
                UInt32 to_max_digits = 0;
137
38.5k
                UInt32 to_precision = 0;
138
38.5k
                UInt32 to_scale = 0;
139
140
38.5k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
38.5k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
38.5k
                    const auto* to_decimal_type =
144
38.5k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
38.5k
                    to_precision = to_decimal_type->get_precision();
146
38.5k
                    ToDataType::check_type_precision(to_precision);
147
148
38.5k
                    to_scale = to_decimal_type->get_scale();
149
38.5k
                    ToDataType::check_type_scale(to_scale);
150
38.5k
                }
151
38.5k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
38.5k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
38.5k
                    to_precision = to_max_digits;
154
38.5k
                }
155
156
38.5k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
38.5k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
38.5k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
38.5k
                if (to_scale > from_scale) {
161
38.5k
                    multiply_may_overflow &=
162
38.5k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
38.5k
                }
164
38.5k
                return narrow_integral || multiply_may_overflow;
165
38.5k
            }
166
38.5k
            return false;
167
38.5k
        });
168
38.5k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
104
4.57k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
4.57k
        using Types = std::decay_t<decltype(types)>;
106
4.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
4.57k
        return call_on_index_and_data_type<
114
4.57k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
4.57k
            using Types2 = std::decay_t<decltype(types2)>;
116
4.57k
            using FromDataType = typename Types2::LeftType;
117
4.57k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
4.57k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
4.57k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
4.57k
                return false;
121
4.57k
            }
122
4.57k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
4.57k
                using FromFieldType = typename FromDataType::FieldType;
124
4.57k
                using ToFieldType = typename ToDataType::FieldType;
125
4.57k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
4.57k
                UInt32 from_scale = 0;
127
128
4.57k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
4.57k
                    const auto* from_decimal_type =
130
4.57k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
4.57k
                    from_precision =
132
4.57k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
4.57k
                    from_scale = from_decimal_type->get_scale();
134
4.57k
                }
135
136
4.57k
                UInt32 to_max_digits = 0;
137
4.57k
                UInt32 to_precision = 0;
138
4.57k
                UInt32 to_scale = 0;
139
140
4.57k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
4.57k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
4.57k
                    const auto* to_decimal_type =
144
4.57k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
4.57k
                    to_precision = to_decimal_type->get_precision();
146
4.57k
                    ToDataType::check_type_precision(to_precision);
147
148
4.57k
                    to_scale = to_decimal_type->get_scale();
149
4.57k
                    ToDataType::check_type_scale(to_scale);
150
4.57k
                }
151
4.57k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
4.57k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
4.57k
                    to_precision = to_max_digits;
154
4.57k
                }
155
156
4.57k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
4.57k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
4.57k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
4.57k
                if (to_scale > from_scale) {
161
4.57k
                    multiply_may_overflow &=
162
4.57k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
4.57k
                }
164
4.57k
                return narrow_integral || multiply_may_overflow;
165
4.57k
            }
166
4.57k
            return false;
167
4.57k
        });
168
4.57k
    };
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
25.1k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
25.1k
        using Types = std::decay_t<decltype(types)>;
106
25.1k
        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.1k
        return call_on_index_and_data_type<
114
25.1k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
25.1k
            using Types2 = std::decay_t<decltype(types2)>;
116
25.1k
            using FromDataType = typename Types2::LeftType;
117
25.1k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
25.1k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
25.1k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
25.1k
                return false;
121
25.1k
            }
122
25.1k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
25.1k
                using FromFieldType = typename FromDataType::FieldType;
124
25.1k
                using ToFieldType = typename ToDataType::FieldType;
125
25.1k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
25.1k
                UInt32 from_scale = 0;
127
128
25.1k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
25.1k
                    const auto* from_decimal_type =
130
25.1k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
25.1k
                    from_precision =
132
25.1k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
25.1k
                    from_scale = from_decimal_type->get_scale();
134
25.1k
                }
135
136
25.1k
                UInt32 to_max_digits = 0;
137
25.1k
                UInt32 to_precision = 0;
138
25.1k
                UInt32 to_scale = 0;
139
140
25.1k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
25.1k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
25.1k
                    const auto* to_decimal_type =
144
25.1k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
25.1k
                    to_precision = to_decimal_type->get_precision();
146
25.1k
                    ToDataType::check_type_precision(to_precision);
147
148
25.1k
                    to_scale = to_decimal_type->get_scale();
149
25.1k
                    ToDataType::check_type_scale(to_scale);
150
25.1k
                }
151
25.1k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
25.1k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
25.1k
                    to_precision = to_max_digits;
154
25.1k
                }
155
156
25.1k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
25.1k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
25.1k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
25.1k
                if (to_scale > from_scale) {
161
25.1k
                    multiply_may_overflow &=
162
25.1k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
25.1k
                }
164
25.1k
                return narrow_integral || multiply_may_overflow;
165
25.1k
            }
166
25.1k
            return false;
167
25.1k
        });
168
25.1k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
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_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
104
19.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
19.9k
        using Types = std::decay_t<decltype(types)>;
106
19.9k
        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
19.9k
        return call_on_index_and_data_type<
114
19.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
19.9k
            using Types2 = std::decay_t<decltype(types2)>;
116
19.9k
            using FromDataType = typename Types2::LeftType;
117
19.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
19.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
19.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
19.9k
                return false;
121
19.9k
            }
122
19.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
19.9k
                using FromFieldType = typename FromDataType::FieldType;
124
19.9k
                using ToFieldType = typename ToDataType::FieldType;
125
19.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
19.9k
                UInt32 from_scale = 0;
127
128
19.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
19.9k
                    const auto* from_decimal_type =
130
19.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
19.9k
                    from_precision =
132
19.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
19.9k
                    from_scale = from_decimal_type->get_scale();
134
19.9k
                }
135
136
19.9k
                UInt32 to_max_digits = 0;
137
19.9k
                UInt32 to_precision = 0;
138
19.9k
                UInt32 to_scale = 0;
139
140
19.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
19.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
19.9k
                    const auto* to_decimal_type =
144
19.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
19.9k
                    to_precision = to_decimal_type->get_precision();
146
19.9k
                    ToDataType::check_type_precision(to_precision);
147
148
19.9k
                    to_scale = to_decimal_type->get_scale();
149
19.9k
                    ToDataType::check_type_scale(to_scale);
150
19.9k
                }
151
19.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
19.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
19.9k
                    to_precision = to_max_digits;
154
19.9k
                }
155
156
19.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
19.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
19.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
19.9k
                if (to_scale > from_scale) {
161
19.9k
                    multiply_may_overflow &=
162
19.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
19.9k
                }
164
19.9k
                return narrow_integral || multiply_may_overflow;
165
19.9k
            }
166
19.9k
            return false;
167
19.9k
        });
168
19.9k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
104
228
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
228
        using Types = std::decay_t<decltype(types)>;
106
228
        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
228
        return call_on_index_and_data_type<
114
228
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
228
            using Types2 = std::decay_t<decltype(types2)>;
116
228
            using FromDataType = typename Types2::LeftType;
117
228
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
228
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
228
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
228
                return false;
121
228
            }
122
228
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
228
                using FromFieldType = typename FromDataType::FieldType;
124
228
                using ToFieldType = typename ToDataType::FieldType;
125
228
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
228
                UInt32 from_scale = 0;
127
128
228
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
228
                    const auto* from_decimal_type =
130
228
                            check_and_get_data_type<FromDataType>(from_type.get());
131
228
                    from_precision =
132
228
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
228
                    from_scale = from_decimal_type->get_scale();
134
228
                }
135
136
228
                UInt32 to_max_digits = 0;
137
228
                UInt32 to_precision = 0;
138
228
                UInt32 to_scale = 0;
139
140
228
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
228
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
228
                    const auto* to_decimal_type =
144
228
                            check_and_get_data_type<ToDataType>(to_type.get());
145
228
                    to_precision = to_decimal_type->get_precision();
146
228
                    ToDataType::check_type_precision(to_precision);
147
148
228
                    to_scale = to_decimal_type->get_scale();
149
228
                    ToDataType::check_type_scale(to_scale);
150
228
                }
151
228
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
228
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
228
                    to_precision = to_max_digits;
154
228
                }
155
156
228
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
228
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
228
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
228
                if (to_scale > from_scale) {
161
228
                    multiply_may_overflow &=
162
228
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
228
                }
164
228
                return narrow_integral || multiply_may_overflow;
165
228
            }
166
228
            return false;
167
228
        });
168
228
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
104
12.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
12.9k
        using Types = std::decay_t<decltype(types)>;
106
12.9k
        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
12.9k
        return call_on_index_and_data_type<
114
12.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
12.9k
            using Types2 = std::decay_t<decltype(types2)>;
116
12.9k
            using FromDataType = typename Types2::LeftType;
117
12.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
12.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
12.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
12.9k
                return false;
121
12.9k
            }
122
12.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
12.9k
                using FromFieldType = typename FromDataType::FieldType;
124
12.9k
                using ToFieldType = typename ToDataType::FieldType;
125
12.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
12.9k
                UInt32 from_scale = 0;
127
128
12.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
12.9k
                    const auto* from_decimal_type =
130
12.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
12.9k
                    from_precision =
132
12.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
12.9k
                    from_scale = from_decimal_type->get_scale();
134
12.9k
                }
135
136
12.9k
                UInt32 to_max_digits = 0;
137
12.9k
                UInt32 to_precision = 0;
138
12.9k
                UInt32 to_scale = 0;
139
140
12.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
12.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
12.9k
                    const auto* to_decimal_type =
144
12.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
12.9k
                    to_precision = to_decimal_type->get_precision();
146
12.9k
                    ToDataType::check_type_precision(to_precision);
147
148
12.9k
                    to_scale = to_decimal_type->get_scale();
149
12.9k
                    ToDataType::check_type_scale(to_scale);
150
12.9k
                }
151
12.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
12.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
12.9k
                    to_precision = to_max_digits;
154
12.9k
                }
155
156
12.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
12.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
12.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
12.9k
                if (to_scale > from_scale) {
161
12.9k
                    multiply_may_overflow &=
162
12.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
12.9k
                }
164
12.9k
                return narrow_integral || multiply_may_overflow;
165
12.9k
            }
166
12.9k
            return false;
167
12.9k
        });
168
12.9k
    };
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.77k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
6.77k
        using Types = std::decay_t<decltype(types)>;
106
6.77k
        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.77k
        return call_on_index_and_data_type<
114
6.77k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
6.77k
            using Types2 = std::decay_t<decltype(types2)>;
116
6.77k
            using FromDataType = typename Types2::LeftType;
117
6.77k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
6.77k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
6.77k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
6.77k
                return false;
121
6.77k
            }
122
6.77k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
6.77k
                using FromFieldType = typename FromDataType::FieldType;
124
6.77k
                using ToFieldType = typename ToDataType::FieldType;
125
6.77k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
6.77k
                UInt32 from_scale = 0;
127
128
6.77k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
6.77k
                    const auto* from_decimal_type =
130
6.77k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
6.77k
                    from_precision =
132
6.77k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
6.77k
                    from_scale = from_decimal_type->get_scale();
134
6.77k
                }
135
136
6.77k
                UInt32 to_max_digits = 0;
137
6.77k
                UInt32 to_precision = 0;
138
6.77k
                UInt32 to_scale = 0;
139
140
6.77k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
6.77k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
6.77k
                    const auto* to_decimal_type =
144
6.77k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
6.77k
                    to_precision = to_decimal_type->get_precision();
146
6.77k
                    ToDataType::check_type_precision(to_precision);
147
148
6.77k
                    to_scale = to_decimal_type->get_scale();
149
6.77k
                    ToDataType::check_type_scale(to_scale);
150
6.77k
                }
151
6.77k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
6.77k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
6.77k
                    to_precision = to_max_digits;
154
6.77k
                }
155
156
6.77k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
6.77k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
6.77k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
6.77k
                if (to_scale > from_scale) {
161
6.77k
                    multiply_may_overflow &=
162
6.77k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
6.77k
                }
164
6.77k
                return narrow_integral || multiply_may_overflow;
165
6.77k
            }
166
6.77k
            return false;
167
6.77k
        });
168
6.77k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
104
3.78k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
3.78k
        using Types = std::decay_t<decltype(types)>;
106
3.78k
        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.78k
        return call_on_index_and_data_type<
114
3.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3.78k
            using Types2 = std::decay_t<decltype(types2)>;
116
3.78k
            using FromDataType = typename Types2::LeftType;
117
3.78k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
3.78k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
3.78k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
3.78k
                return false;
121
3.78k
            }
122
3.78k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
3.78k
                using FromFieldType = typename FromDataType::FieldType;
124
3.78k
                using ToFieldType = typename ToDataType::FieldType;
125
3.78k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
3.78k
                UInt32 from_scale = 0;
127
128
3.78k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
3.78k
                    const auto* from_decimal_type =
130
3.78k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
3.78k
                    from_precision =
132
3.78k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
3.78k
                    from_scale = from_decimal_type->get_scale();
134
3.78k
                }
135
136
3.78k
                UInt32 to_max_digits = 0;
137
3.78k
                UInt32 to_precision = 0;
138
3.78k
                UInt32 to_scale = 0;
139
140
3.78k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
3.78k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
3.78k
                    const auto* to_decimal_type =
144
3.78k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
3.78k
                    to_precision = to_decimal_type->get_precision();
146
3.78k
                    ToDataType::check_type_precision(to_precision);
147
148
3.78k
                    to_scale = to_decimal_type->get_scale();
149
3.78k
                    ToDataType::check_type_scale(to_scale);
150
3.78k
                }
151
3.78k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
3.78k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
3.78k
                    to_precision = to_max_digits;
154
3.78k
                }
155
156
3.78k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
3.78k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
3.78k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
3.78k
                if (to_scale > from_scale) {
161
3.78k
                    multiply_may_overflow &=
162
3.78k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
3.78k
                }
164
3.78k
                return narrow_integral || multiply_may_overflow;
165
3.78k
            }
166
3.78k
            return false;
167
3.78k
        });
168
3.78k
    };
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
640
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
640
        using Types = std::decay_t<decltype(types)>;
106
640
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
640
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
640
            return false;
112
640
        }
113
0
        return call_on_index_and_data_type<
114
640
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
640
            using Types2 = std::decay_t<decltype(types2)>;
116
640
            using FromDataType = typename Types2::LeftType;
117
640
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
640
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
640
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
640
                return false;
121
640
            }
122
640
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
640
                using FromFieldType = typename FromDataType::FieldType;
124
640
                using ToFieldType = typename ToDataType::FieldType;
125
640
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
640
                UInt32 from_scale = 0;
127
128
640
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
640
                    const auto* from_decimal_type =
130
640
                            check_and_get_data_type<FromDataType>(from_type.get());
131
640
                    from_precision =
132
640
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
640
                    from_scale = from_decimal_type->get_scale();
134
640
                }
135
136
640
                UInt32 to_max_digits = 0;
137
640
                UInt32 to_precision = 0;
138
640
                UInt32 to_scale = 0;
139
140
640
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
640
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
640
                    const auto* to_decimal_type =
144
640
                            check_and_get_data_type<ToDataType>(to_type.get());
145
640
                    to_precision = to_decimal_type->get_precision();
146
640
                    ToDataType::check_type_precision(to_precision);
147
148
640
                    to_scale = to_decimal_type->get_scale();
149
640
                    ToDataType::check_type_scale(to_scale);
150
640
                }
151
640
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
640
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
640
                    to_precision = to_max_digits;
154
640
                }
155
156
640
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
640
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
640
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
640
                if (to_scale > from_scale) {
161
640
                    multiply_may_overflow &=
162
640
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
640
                }
164
640
                return narrow_integral || multiply_may_overflow;
165
640
            }
166
640
            return false;
167
640
        });
168
640
    };
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
37.3k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
37.3k
        using Types = std::decay_t<decltype(types)>;
106
37.3k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
37.3k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
37.3k
            return false;
112
37.3k
        }
113
0
        return call_on_index_and_data_type<
114
37.3k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
37.3k
            using Types2 = std::decay_t<decltype(types2)>;
116
37.3k
            using FromDataType = typename Types2::LeftType;
117
37.3k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
37.3k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
37.3k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
37.3k
                return false;
121
37.3k
            }
122
37.3k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
37.3k
                using FromFieldType = typename FromDataType::FieldType;
124
37.3k
                using ToFieldType = typename ToDataType::FieldType;
125
37.3k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
37.3k
                UInt32 from_scale = 0;
127
128
37.3k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
37.3k
                    const auto* from_decimal_type =
130
37.3k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
37.3k
                    from_precision =
132
37.3k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
37.3k
                    from_scale = from_decimal_type->get_scale();
134
37.3k
                }
135
136
37.3k
                UInt32 to_max_digits = 0;
137
37.3k
                UInt32 to_precision = 0;
138
37.3k
                UInt32 to_scale = 0;
139
140
37.3k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
37.3k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
37.3k
                    const auto* to_decimal_type =
144
37.3k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
37.3k
                    to_precision = to_decimal_type->get_precision();
146
37.3k
                    ToDataType::check_type_precision(to_precision);
147
148
37.3k
                    to_scale = to_decimal_type->get_scale();
149
37.3k
                    ToDataType::check_type_scale(to_scale);
150
37.3k
                }
151
37.3k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
37.3k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
37.3k
                    to_precision = to_max_digits;
154
37.3k
                }
155
156
37.3k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
37.3k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
37.3k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
37.3k
                if (to_scale > from_scale) {
161
37.3k
                    multiply_may_overflow &=
162
37.3k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
37.3k
                }
164
37.3k
                return narrow_integral || multiply_may_overflow;
165
37.3k
            }
166
37.3k
            return false;
167
37.3k
        });
168
37.3k
    };
169
170
310k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
171
380k
}
172
173
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
174
409k
                                    const DataTypePtr& to_type) {
175
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
176
409k
    bool result_is_nullable = to_type->is_nullable();
177
178
409k
    if (result_is_nullable) {
179
380k
        return [from_type, to_type](FunctionContext* context, Block& block,
180
380k
                                    const ColumnNumbers& arguments, uint32_t result,
181
380k
                                    size_t input_rows_count,
182
380k
                                    const NullMap::value_type* null_map = nullptr) {
183
380k
            auto from_type_not_nullable = remove_nullable(from_type);
184
380k
            auto to_type_not_nullable = remove_nullable(to_type);
185
186
380k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
187
380k
                    context, from_type_not_nullable, to_type_not_nullable);
188
189
380k
            auto nested_result_index = block.columns();
190
380k
            block.insert(block.get_by_position(result).unnest_nullable());
191
380k
            auto nested_source_index = block.columns();
192
380k
            block.insert(block.get_by_position(arguments[0])
193
380k
                                 .unnest_nullable(replace_null_data_to_default));
194
195
380k
            const auto& arg_col = block.get_by_position(arguments[0]);
196
380k
            const NullMap::value_type* arg_null_map = nullptr;
197
380k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
198
336k
                arg_null_map = nullable->get_null_map_data().data();
199
336k
            }
200
380k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
201
380k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
202
380k
                    arg_null_map));
203
204
355k
            block.get_by_position(result).column =
205
355k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
206
355k
                                     arguments, input_rows_count);
207
208
355k
            block.erase(nested_source_index);
209
355k
            block.erase(nested_result_index);
210
355k
            return Status::OK();
211
380k
        };
212
380k
    } else {
213
28.6k
        return prepare_impl(context, from_type, to_type);
214
28.6k
    }
215
409k
}
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
423k
                         const DataTypePtr& origin_to_type) {
221
423k
    auto to_type = get_serialized_type(origin_to_type);
222
423k
    auto from_type = get_serialized_type(origin_from_type);
223
423k
    if (from_type->equals(*to_type)) {
224
75.2k
        return create_identity_wrapper(from_type);
225
75.2k
    }
226
227
    // variant needs to be judged first
228
348k
    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
336k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
233
16.4k
        return create_cast_from_variant_wrapper(static_cast<const DataTypeVariant&>(*from_type),
234
16.4k
                                                to_type);
235
16.4k
    }
236
237
320k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
238
9.33k
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
239
9.33k
                                              to_type,
240
9.33k
                                              context ? context->jsonb_string_as_string() : false);
241
9.33k
    }
242
243
311k
    switch (to_type->get_primitive_type()) {
244
951
    case PrimitiveType::TYPE_BOOLEAN:
245
951
        return create_boolean_wrapper(context, from_type);
246
4.81k
    case PrimitiveType::TYPE_TINYINT:
247
4.81k
        return create_int_wrapper<DataTypeInt8>(context, from_type);
248
5.39k
    case PrimitiveType::TYPE_SMALLINT:
249
5.39k
        return create_int_wrapper<DataTypeInt16>(context, from_type);
250
32.4k
    case PrimitiveType::TYPE_INT:
251
32.4k
        return create_int_wrapper<DataTypeInt32>(context, from_type);
252
44.3k
    case PrimitiveType::TYPE_BIGINT:
253
44.3k
        return create_int_wrapper<DataTypeInt64>(context, from_type);
254
4.05k
    case PrimitiveType::TYPE_LARGEINT:
255
4.05k
        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
28.9k
    case PrimitiveType::TYPE_DOUBLE:
259
28.9k
        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.83k
    case PrimitiveType::TYPE_DATEV2:
265
6.83k
        return create_datelike_wrapper<DataTypeDateV2>(context, from_type);
266
4.15k
    case PrimitiveType::TYPE_DATETIMEV2:
267
4.15k
        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.89k
    case PrimitiveType::TYPE_DECIMAL32:
279
6.89k
        return create_decimal_wrapper<DataTypeDecimal32>(context, from_type);
280
22.8k
    case PrimitiveType::TYPE_DECIMAL64:
281
22.8k
        return create_decimal_wrapper<DataTypeDecimal64>(context, from_type);
282
15.8k
    case PrimitiveType::TYPE_DECIMAL128I:
283
15.8k
        return create_decimal_wrapper<DataTypeDecimal128>(context, from_type);
284
7.63k
    case PrimitiveType::TYPE_DECIMAL256:
285
7.63k
        return create_decimal_wrapper<DataTypeDecimal256>(context, from_type);
286
33
    case PrimitiveType::TYPE_CHAR:
287
6.89k
    case PrimitiveType::TYPE_VARCHAR:
288
34.4k
    case PrimitiveType::TYPE_STRING:
289
34.4k
        return create_string_wrapper(from_type);
290
14.7k
    case PrimitiveType::TYPE_ARRAY:
291
14.7k
        return create_array_wrapper(context, from_type,
292
14.7k
                                    static_cast<const DataTypeArray&>(*to_type));
293
3.11k
    case PrimitiveType::TYPE_STRUCT:
294
3.11k
        return create_struct_wrapper(context, from_type,
295
3.11k
                                     static_cast<const DataTypeStruct&>(*to_type));
296
2.56k
    case PrimitiveType::TYPE_MAP:
297
2.56k
        return create_map_wrapper(context, from_type, static_cast<const DataTypeMap&>(*to_type));
298
4
    case PrimitiveType::TYPE_HLL:
299
4
        return create_hll_wrapper(context, from_type, static_cast<const DataTypeHLL&>(*to_type));
300
5
    case PrimitiveType::TYPE_BITMAP:
301
5
        return create_bitmap_wrapper(context, from_type,
302
5
                                     static_cast<const DataTypeBitMap&>(*to_type));
303
59.1k
    case PrimitiveType::TYPE_JSONB:
304
59.1k
        return create_cast_to_jsonb_wrapper(from_type, static_cast<const DataTypeJsonb&>(*to_type),
305
59.1k
                                            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
311k
    }
311
312
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
313
311k
}
314
315
} // namespace CastWrapper
316
317
class PreparedFunctionCast : public PreparedFunctionImpl {
318
public:
319
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
320
394k
            : 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
394k
                        uint32_t result, size_t input_rows_count) const override {
327
394k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
328
394k
    }
329
330
394k
    bool use_default_implementation_for_nulls() const override { return false; }
331
394k
    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
295k
            : name(name_),
342
295k
              argument_types(std::move(argument_types_)),
343
295k
              return_type(std::move(return_type_)) {}
344
345
394k
    const DataTypes& get_argument_types() const override { return argument_types; }
346
394k
    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
394k
                                uint32_t /*result*/) const override {
351
394k
        return std::make_shared<PreparedFunctionCast>(
352
394k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
353
394k
                                                         get_return_type()),
354
394k
                name);
355
394k
    }
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
295k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
372
373
295k
    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
294k
                               const DataTypePtr& return_type) const override {
384
294k
        DataTypes data_types(arguments.size());
385
386
885k
        for (size_t i = 0; i < arguments.size(); ++i) {
387
590k
            data_types[i] = arguments[i].type;
388
590k
        }
389
390
294k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
391
294k
    }
392
393
295k
    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