Coverage Report

Created: 2026-03-12 15:22

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
403k
                                        const DataTypePtr& to_type) {
74
403k
    const auto& from_nested = from_type;
75
403k
    const auto& to_nested = to_type;
76
77
403k
    if (from_type->is_null_literal()) {
78
2.16k
        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.16k
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
84
2.16k
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
85
            /// TODO: remove this in the future.
86
2.16k
            auto& res = block.get_by_position(result);
87
2.16k
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
88
2.16k
                                 ->convert_to_full_column_if_const();
89
2.16k
            return Status::OK();
90
2.16k
        };
91
2.16k
    }
92
93
401k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
94
95
401k
    return wrapper;
96
403k
}
97
98
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
99
373k
                                       const DataTypePtr& to_type) {
100
373k
    if (from_type->equals(*to_type)) {
101
70.6k
        return false;
102
70.6k
    }
103
104
302k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
214k
        using Types = std::decay_t<decltype(types)>;
106
214k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
38.0k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
38.0k
            return false;
112
38.0k
        }
113
0
        return call_on_index_and_data_type<
114
214k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
159k
            using Types2 = std::decay_t<decltype(types2)>;
116
159k
            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
46.2k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
46.2k
                using FromFieldType = typename FromDataType::FieldType;
124
46.2k
                using ToFieldType = typename ToDataType::FieldType;
125
46.2k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
46.2k
                UInt32 from_scale = 0;
127
128
46.2k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
20.4k
                    const auto* from_decimal_type =
130
20.4k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
20.4k
                    from_precision =
132
20.4k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
20.4k
                    from_scale = from_decimal_type->get_scale();
134
20.4k
                }
135
136
46.2k
                UInt32 to_max_digits = 0;
137
46.2k
                UInt32 to_precision = 0;
138
46.2k
                UInt32 to_scale = 0;
139
140
46.2k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
41.3k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
41.3k
                    const auto* to_decimal_type =
144
41.3k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
41.3k
                    to_precision = to_decimal_type->get_precision();
146
41.3k
                    ToDataType::check_type_precision(to_precision);
147
148
41.3k
                    to_scale = to_decimal_type->get_scale();
149
41.3k
                    ToDataType::check_type_scale(to_scale);
150
41.3k
                }
151
46.2k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
4.78k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
4.78k
                    to_precision = to_max_digits;
154
4.78k
                }
155
156
46.2k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
46.2k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
46.2k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
46.2k
                if (to_scale > from_scale) {
161
10.2k
                    multiply_may_overflow &=
162
10.2k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
10.2k
                }
164
46.2k
                return narrow_integral || multiply_may_overflow;
165
46.2k
            }
166
0
            return false;
167
159k
        });
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
823
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
823
            using Types2 = std::decay_t<decltype(types2)>;
116
823
            using FromDataType = typename 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
823
            return false;
167
823
        });
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
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
        });
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
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
24
            using Types2 = std::decay_t<decltype(types2)>;
116
24
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
24
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
24
                using FromFieldType = typename FromDataType::FieldType;
124
24
                using ToFieldType = typename ToDataType::FieldType;
125
24
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
24
                UInt32 from_scale = 0;
127
128
24
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
24
                    const auto* from_decimal_type =
130
24
                            check_and_get_data_type<FromDataType>(from_type.get());
131
24
                    from_precision =
132
24
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
24
                    from_scale = from_decimal_type->get_scale();
134
24
                }
135
136
24
                UInt32 to_max_digits = 0;
137
24
                UInt32 to_precision = 0;
138
24
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
24
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
24
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
24
                    to_precision = to_max_digits;
154
24
                }
155
156
24
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
24
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
24
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
24
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
24
                return narrow_integral || multiply_may_overflow;
165
24
            }
166
0
            return false;
167
24
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
114
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
8
            using Types2 = std::decay_t<decltype(types2)>;
116
8
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
8
                using FromFieldType = typename FromDataType::FieldType;
124
8
                using ToFieldType = typename ToDataType::FieldType;
125
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
8
                UInt32 from_scale = 0;
127
128
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
8
                    const auto* from_decimal_type =
130
8
                            check_and_get_data_type<FromDataType>(from_type.get());
131
8
                    from_precision =
132
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
8
                    from_scale = from_decimal_type->get_scale();
134
8
                }
135
136
8
                UInt32 to_max_digits = 0;
137
8
                UInt32 to_precision = 0;
138
8
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
8
                    to_precision = to_max_digits;
154
8
                }
155
156
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
8
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
8
                return narrow_integral || multiply_may_overflow;
165
8
            }
166
0
            return false;
167
8
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
114
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
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
25
            using Types2 = std::decay_t<decltype(types2)>;
116
25
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
25
                using FromFieldType = typename FromDataType::FieldType;
124
25
                using ToFieldType = typename ToDataType::FieldType;
125
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
25
                UInt32 from_scale = 0;
127
128
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
25
                    const auto* from_decimal_type =
130
25
                            check_and_get_data_type<FromDataType>(from_type.get());
131
25
                    from_precision =
132
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
25
                    from_scale = from_decimal_type->get_scale();
134
25
                }
135
136
25
                UInt32 to_max_digits = 0;
137
25
                UInt32 to_precision = 0;
138
25
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
25
                    to_precision = to_max_digits;
154
25
                }
155
156
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
25
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
25
                return narrow_integral || multiply_may_overflow;
165
25
            }
166
0
            return false;
167
25
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
114
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
72
            using Types2 = std::decay_t<decltype(types2)>;
116
72
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
72
            return false;
167
72
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
114
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
24
            using Types2 = std::decay_t<decltype(types2)>;
116
24
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
24
            return false;
167
24
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
114
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
320
            using Types2 = std::decay_t<decltype(types2)>;
116
320
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
320
            return false;
167
320
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
114
2.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
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_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
114
1.99k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.99k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.99k
            using FromDataType = typename 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.99k
            return false;
167
1.99k
        });
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
161
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
161
            using Types2 = std::decay_t<decltype(types2)>;
116
161
            using FromDataType = typename 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
161
            return false;
167
161
        });
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
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
99
            using Types2 = std::decay_t<decltype(types2)>;
116
99
            using FromDataType = typename 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
99
            return false;
167
99
        });
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
26
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
26
            using Types2 = std::decay_t<decltype(types2)>;
116
26
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
26
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
26
                using FromFieldType = typename FromDataType::FieldType;
124
26
                using ToFieldType = typename ToDataType::FieldType;
125
26
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
26
                UInt32 from_scale = 0;
127
128
26
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
26
                    const auto* from_decimal_type =
130
26
                            check_and_get_data_type<FromDataType>(from_type.get());
131
26
                    from_precision =
132
26
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
26
                    from_scale = from_decimal_type->get_scale();
134
26
                }
135
136
26
                UInt32 to_max_digits = 0;
137
26
                UInt32 to_precision = 0;
138
26
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
26
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
26
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
26
                    to_precision = to_max_digits;
154
26
                }
155
156
26
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
26
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
26
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
26
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
26
                return narrow_integral || multiply_may_overflow;
165
26
            }
166
0
            return false;
167
26
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
114
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
72
            using Types2 = std::decay_t<decltype(types2)>;
116
72
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
72
            return false;
167
72
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
114
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
24
            using Types2 = std::decay_t<decltype(types2)>;
116
24
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
24
            return false;
167
24
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
114
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
320
            using Types2 = std::decay_t<decltype(types2)>;
116
320
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
320
            return false;
167
320
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
114
2.20k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.20k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.20k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
2.20k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
2.20k
                return false;
121
2.20k
            }
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.20k
            return false;
167
2.20k
        });
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
416
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
416
            using Types2 = std::decay_t<decltype(types2)>;
116
416
            using FromDataType = typename 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
416
            return false;
167
416
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
114
1.53k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.53k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.53k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1.53k
            return false;
167
1.53k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
114
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_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
22
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
22
            using Types2 = std::decay_t<decltype(types2)>;
116
22
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
22
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
22
                using FromFieldType = typename FromDataType::FieldType;
124
22
                using ToFieldType = typename ToDataType::FieldType;
125
22
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
22
                UInt32 from_scale = 0;
127
128
22
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
22
                    const auto* from_decimal_type =
130
22
                            check_and_get_data_type<FromDataType>(from_type.get());
131
22
                    from_precision =
132
22
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
22
                    from_scale = from_decimal_type->get_scale();
134
22
                }
135
136
22
                UInt32 to_max_digits = 0;
137
22
                UInt32 to_precision = 0;
138
22
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
22
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
22
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
22
                    to_precision = to_max_digits;
154
22
                }
155
156
22
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
22
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
22
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
22
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
22
                return narrow_integral || multiply_may_overflow;
165
22
            }
166
0
            return false;
167
22
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
114
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
16
            using Types2 = std::decay_t<decltype(types2)>;
116
16
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
16
            return false;
167
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
114
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
24
            using Types2 = std::decay_t<decltype(types2)>;
116
24
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
24
            return false;
167
24
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
114
276
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
276
            using Types2 = std::decay_t<decltype(types2)>;
116
276
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
276
            return false;
167
276
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
114
17.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
493
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
493
            using Types2 = std::decay_t<decltype(types2)>;
116
493
            using FromDataType = typename 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
493
            return false;
167
493
        });
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
589
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
589
            using Types2 = std::decay_t<decltype(types2)>;
116
589
            using FromDataType = typename 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
589
            return false;
167
589
        });
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.59k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7.59k
            using Types2 = std::decay_t<decltype(types2)>;
116
7.59k
            using FromDataType = typename 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.59k
            return false;
167
7.59k
        });
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
632
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
632
            using Types2 = std::decay_t<decltype(types2)>;
116
632
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
632
            return false;
167
632
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
114
2.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
312
                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
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
318
                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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
114
304
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
304
            using Types2 = std::decay_t<decltype(types2)>;
116
304
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
304
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
304
                using FromFieldType = typename FromDataType::FieldType;
124
304
                using ToFieldType = typename ToDataType::FieldType;
125
304
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
304
                UInt32 from_scale = 0;
127
128
304
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
304
                    const auto* from_decimal_type =
130
304
                            check_and_get_data_type<FromDataType>(from_type.get());
131
304
                    from_precision =
132
304
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
304
                    from_scale = from_decimal_type->get_scale();
134
304
                }
135
136
304
                UInt32 to_max_digits = 0;
137
304
                UInt32 to_precision = 0;
138
304
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
304
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
304
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
304
                    to_precision = to_max_digits;
154
304
                }
155
156
304
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
304
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
304
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
304
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
304
                return narrow_integral || multiply_may_overflow;
165
304
            }
166
0
            return false;
167
304
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
114
612
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
612
            using Types2 = std::decay_t<decltype(types2)>;
116
612
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
612
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
612
                using FromFieldType = typename FromDataType::FieldType;
124
612
                using ToFieldType = typename ToDataType::FieldType;
125
612
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
612
                UInt32 from_scale = 0;
127
128
612
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
612
                    const auto* from_decimal_type =
130
612
                            check_and_get_data_type<FromDataType>(from_type.get());
131
612
                    from_precision =
132
612
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
612
                    from_scale = from_decimal_type->get_scale();
134
612
                }
135
136
612
                UInt32 to_max_digits = 0;
137
612
                UInt32 to_precision = 0;
138
612
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
612
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
612
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
612
                    to_precision = to_max_digits;
154
612
                }
155
156
612
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
612
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
612
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
612
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
612
                return narrow_integral || multiply_may_overflow;
165
612
            }
166
0
            return false;
167
612
        });
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
22
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
22
            using Types2 = std::decay_t<decltype(types2)>;
116
22
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
22
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
22
                using FromFieldType = typename FromDataType::FieldType;
124
22
                using ToFieldType = typename ToDataType::FieldType;
125
22
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
22
                UInt32 from_scale = 0;
127
128
22
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
22
                    const auto* from_decimal_type =
130
22
                            check_and_get_data_type<FromDataType>(from_type.get());
131
22
                    from_precision =
132
22
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
22
                    from_scale = from_decimal_type->get_scale();
134
22
                }
135
136
22
                UInt32 to_max_digits = 0;
137
22
                UInt32 to_precision = 0;
138
22
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
22
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
22
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
22
                    to_precision = to_max_digits;
154
22
                }
155
156
22
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
22
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
22
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
22
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
22
                return narrow_integral || multiply_may_overflow;
165
22
            }
166
0
            return false;
167
22
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_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.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
        });
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
134
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
134
            using Types2 = std::decay_t<decltype(types2)>;
116
134
            using FromDataType = typename 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
134
            return false;
167
134
        });
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
601
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
601
            using Types2 = std::decay_t<decltype(types2)>;
116
601
            using FromDataType = typename 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
601
            return false;
167
601
        });
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
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
            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
425
            return false;
167
425
        });
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
548
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
548
            using Types2 = std::decay_t<decltype(types2)>;
116
548
            using FromDataType = typename 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
548
            return false;
167
548
        });
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.10k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.10k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.10k
            using FromDataType = typename 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.10k
            return false;
167
1.10k
        });
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.16k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.16k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.16k
            using FromDataType = typename 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.16k
            return false;
167
1.16k
        });
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.48k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.48k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.48k
            using FromDataType = typename 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.48k
            return false;
167
1.48k
        });
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.22k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.22k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.22k
            using FromDataType = typename 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.22k
            return false;
167
1.22k
        });
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
543
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
543
            using Types2 = std::decay_t<decltype(types2)>;
116
543
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
543
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
543
                using FromFieldType = typename FromDataType::FieldType;
124
543
                using ToFieldType = typename ToDataType::FieldType;
125
543
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
543
                UInt32 from_scale = 0;
127
128
543
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
543
                    const auto* from_decimal_type =
130
543
                            check_and_get_data_type<FromDataType>(from_type.get());
131
543
                    from_precision =
132
543
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
543
                    from_scale = from_decimal_type->get_scale();
134
543
                }
135
136
543
                UInt32 to_max_digits = 0;
137
543
                UInt32 to_precision = 0;
138
543
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
543
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
543
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
543
                    to_precision = to_max_digits;
154
543
                }
155
156
543
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
543
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
543
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
543
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
543
                return narrow_integral || multiply_may_overflow;
165
543
            }
166
0
            return false;
167
543
        });
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
322
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
322
            using Types2 = std::decay_t<decltype(types2)>;
116
322
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
322
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
322
                using FromFieldType = typename FromDataType::FieldType;
124
322
                using ToFieldType = typename ToDataType::FieldType;
125
322
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
322
                UInt32 from_scale = 0;
127
128
322
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
322
                    const auto* from_decimal_type =
130
322
                            check_and_get_data_type<FromDataType>(from_type.get());
131
322
                    from_precision =
132
322
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
322
                    from_scale = from_decimal_type->get_scale();
134
322
                }
135
136
322
                UInt32 to_max_digits = 0;
137
322
                UInt32 to_precision = 0;
138
322
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
322
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
322
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
322
                    to_precision = to_max_digits;
154
322
                }
155
156
322
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
322
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
322
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
322
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
322
                return narrow_integral || multiply_may_overflow;
165
322
            }
166
0
            return false;
167
322
        });
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
53
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
53
            using Types2 = std::decay_t<decltype(types2)>;
116
53
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
53
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
53
                using FromFieldType = typename FromDataType::FieldType;
124
53
                using ToFieldType = typename ToDataType::FieldType;
125
53
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
53
                UInt32 from_scale = 0;
127
128
53
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
53
                    const auto* from_decimal_type =
130
53
                            check_and_get_data_type<FromDataType>(from_type.get());
131
53
                    from_precision =
132
53
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
53
                    from_scale = from_decimal_type->get_scale();
134
53
                }
135
136
53
                UInt32 to_max_digits = 0;
137
53
                UInt32 to_precision = 0;
138
53
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
53
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
53
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
53
                    to_precision = to_max_digits;
154
53
                }
155
156
53
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
53
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
53
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
53
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
53
                return narrow_integral || multiply_may_overflow;
165
53
            }
166
0
            return false;
167
53
        });
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
435
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
435
            using Types2 = std::decay_t<decltype(types2)>;
116
435
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
435
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
435
                using FromFieldType = typename FromDataType::FieldType;
124
435
                using ToFieldType = typename ToDataType::FieldType;
125
435
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
435
                UInt32 from_scale = 0;
127
128
435
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
435
                    const auto* from_decimal_type =
130
435
                            check_and_get_data_type<FromDataType>(from_type.get());
131
435
                    from_precision =
132
435
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
435
                    from_scale = from_decimal_type->get_scale();
134
435
                }
135
136
435
                UInt32 to_max_digits = 0;
137
435
                UInt32 to_precision = 0;
138
435
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
435
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
435
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
435
                    to_precision = to_max_digits;
154
435
                }
155
156
435
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
435
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
435
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
435
                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
435
            }
166
0
            return false;
167
435
        });
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
282
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
282
            using Types2 = std::decay_t<decltype(types2)>;
116
282
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
282
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
282
                using FromFieldType = typename FromDataType::FieldType;
124
282
                using ToFieldType = typename ToDataType::FieldType;
125
282
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
282
                UInt32 from_scale = 0;
127
128
282
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
282
                    const auto* from_decimal_type =
130
282
                            check_and_get_data_type<FromDataType>(from_type.get());
131
282
                    from_precision =
132
282
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
282
                    from_scale = from_decimal_type->get_scale();
134
282
                }
135
136
282
                UInt32 to_max_digits = 0;
137
282
                UInt32 to_precision = 0;
138
282
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
282
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
282
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
282
                    to_precision = to_max_digits;
154
282
                }
155
156
282
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
282
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
282
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
282
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
282
                return narrow_integral || multiply_may_overflow;
165
282
            }
166
0
            return false;
167
282
        });
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.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
            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.63k
            return false;
167
6.63k
        });
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
356
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
356
            using Types2 = std::decay_t<decltype(types2)>;
116
356
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
356
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
356
                using FromFieldType = typename FromDataType::FieldType;
124
356
                using ToFieldType = typename ToDataType::FieldType;
125
356
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
356
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
356
                UInt32 to_max_digits = 0;
137
356
                UInt32 to_precision = 0;
138
356
                UInt32 to_scale = 0;
139
140
356
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
356
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
356
                    const auto* to_decimal_type =
144
356
                            check_and_get_data_type<ToDataType>(to_type.get());
145
356
                    to_precision = to_decimal_type->get_precision();
146
356
                    ToDataType::check_type_precision(to_precision);
147
148
356
                    to_scale = to_decimal_type->get_scale();
149
356
                    ToDataType::check_type_scale(to_scale);
150
356
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
356
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
356
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
356
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
356
                if (to_scale > from_scale) {
161
223
                    multiply_may_overflow &=
162
223
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
223
                }
164
356
                return narrow_integral || multiply_may_overflow;
165
356
            }
166
0
            return false;
167
356
        });
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
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
414
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
414
                using FromFieldType = typename FromDataType::FieldType;
124
414
                using ToFieldType = typename ToDataType::FieldType;
125
414
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
414
                UInt32 from_scale = 0;
127
128
414
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
414
                    const auto* from_decimal_type =
130
414
                            check_and_get_data_type<FromDataType>(from_type.get());
131
414
                    from_precision =
132
414
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
414
                    from_scale = from_decimal_type->get_scale();
134
414
                }
135
136
414
                UInt32 to_max_digits = 0;
137
414
                UInt32 to_precision = 0;
138
414
                UInt32 to_scale = 0;
139
140
414
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
414
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
414
                    const auto* to_decimal_type =
144
414
                            check_and_get_data_type<ToDataType>(to_type.get());
145
414
                    to_precision = to_decimal_type->get_precision();
146
414
                    ToDataType::check_type_precision(to_precision);
147
148
414
                    to_scale = to_decimal_type->get_scale();
149
414
                    ToDataType::check_type_scale(to_scale);
150
414
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
414
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
414
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
414
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
414
                if (to_scale > from_scale) {
161
87
                    multiply_may_overflow &=
162
87
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
87
                }
164
414
                return narrow_integral || multiply_may_overflow;
165
414
            }
166
0
            return false;
167
414
        });
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
433
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
433
            using Types2 = std::decay_t<decltype(types2)>;
116
433
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
433
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
433
                using FromFieldType = typename FromDataType::FieldType;
124
433
                using ToFieldType = typename ToDataType::FieldType;
125
433
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
433
                UInt32 from_scale = 0;
127
128
433
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
433
                    const auto* from_decimal_type =
130
433
                            check_and_get_data_type<FromDataType>(from_type.get());
131
433
                    from_precision =
132
433
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
433
                    from_scale = from_decimal_type->get_scale();
134
433
                }
135
136
433
                UInt32 to_max_digits = 0;
137
433
                UInt32 to_precision = 0;
138
433
                UInt32 to_scale = 0;
139
140
433
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
433
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
433
                    const auto* to_decimal_type =
144
433
                            check_and_get_data_type<ToDataType>(to_type.get());
145
433
                    to_precision = to_decimal_type->get_precision();
146
433
                    ToDataType::check_type_precision(to_precision);
147
148
433
                    to_scale = to_decimal_type->get_scale();
149
433
                    ToDataType::check_type_scale(to_scale);
150
433
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
433
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
433
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
433
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
433
                if (to_scale > from_scale) {
161
142
                    multiply_may_overflow &=
162
142
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
142
                }
164
433
                return narrow_integral || multiply_may_overflow;
165
433
            }
166
0
            return false;
167
433
        });
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
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
72
            using Types2 = std::decay_t<decltype(types2)>;
116
72
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
72
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
72
                using FromFieldType = typename FromDataType::FieldType;
124
72
                using ToFieldType = typename ToDataType::FieldType;
125
72
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
72
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
72
                UInt32 to_max_digits = 0;
137
72
                UInt32 to_precision = 0;
138
72
                UInt32 to_scale = 0;
139
140
72
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
72
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
72
                    const auto* to_decimal_type =
144
72
                            check_and_get_data_type<ToDataType>(to_type.get());
145
72
                    to_precision = to_decimal_type->get_precision();
146
72
                    ToDataType::check_type_precision(to_precision);
147
148
72
                    to_scale = to_decimal_type->get_scale();
149
72
                    ToDataType::check_type_scale(to_scale);
150
72
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
72
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
72
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
72
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
72
                if (to_scale > from_scale) {
161
59
                    multiply_may_overflow &=
162
59
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
59
                }
164
72
                return narrow_integral || multiply_may_overflow;
165
72
            }
166
0
            return false;
167
72
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
114
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
49
            using Types2 = std::decay_t<decltype(types2)>;
116
49
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
49
                using FromFieldType = typename FromDataType::FieldType;
124
49
                using ToFieldType = typename ToDataType::FieldType;
125
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
49
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
49
                UInt32 to_max_digits = 0;
137
49
                UInt32 to_precision = 0;
138
49
                UInt32 to_scale = 0;
139
140
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
49
                    const auto* to_decimal_type =
144
49
                            check_and_get_data_type<ToDataType>(to_type.get());
145
49
                    to_precision = to_decimal_type->get_precision();
146
49
                    ToDataType::check_type_precision(to_precision);
147
148
49
                    to_scale = to_decimal_type->get_scale();
149
49
                    ToDataType::check_type_scale(to_scale);
150
49
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
49
                if (to_scale > from_scale) {
161
38
                    multiply_may_overflow &=
162
38
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
38
                }
164
49
                return narrow_integral || multiply_may_overflow;
165
49
            }
166
0
            return false;
167
49
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
114
475
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
475
            using Types2 = std::decay_t<decltype(types2)>;
116
475
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
475
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
475
                using FromFieldType = typename FromDataType::FieldType;
124
475
                using ToFieldType = typename ToDataType::FieldType;
125
475
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
475
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
475
                UInt32 to_max_digits = 0;
137
475
                UInt32 to_precision = 0;
138
475
                UInt32 to_scale = 0;
139
140
475
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
475
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
475
                    const auto* to_decimal_type =
144
475
                            check_and_get_data_type<ToDataType>(to_type.get());
145
475
                    to_precision = to_decimal_type->get_precision();
146
475
                    ToDataType::check_type_precision(to_precision);
147
148
475
                    to_scale = to_decimal_type->get_scale();
149
475
                    ToDataType::check_type_scale(to_scale);
150
475
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
475
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
475
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
475
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
475
                if (to_scale > from_scale) {
161
322
                    multiply_may_overflow &=
162
322
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
322
                }
164
475
                return narrow_integral || multiply_may_overflow;
165
475
            }
166
0
            return false;
167
475
        });
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
771
                    multiply_may_overflow &=
162
771
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
771
                }
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
4.21k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
4.21k
            using Types2 = std::decay_t<decltype(types2)>;
116
4.21k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
4.21k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
4.21k
                using FromFieldType = typename FromDataType::FieldType;
124
4.21k
                using ToFieldType = typename ToDataType::FieldType;
125
4.21k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
4.21k
                UInt32 from_scale = 0;
127
128
4.21k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
4.21k
                    const auto* from_decimal_type =
130
4.21k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
4.21k
                    from_precision =
132
4.21k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
4.21k
                    from_scale = from_decimal_type->get_scale();
134
4.21k
                }
135
136
4.21k
                UInt32 to_max_digits = 0;
137
4.21k
                UInt32 to_precision = 0;
138
4.21k
                UInt32 to_scale = 0;
139
140
4.21k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
4.21k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
4.21k
                    const auto* to_decimal_type =
144
4.21k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
4.21k
                    to_precision = to_decimal_type->get_precision();
146
4.21k
                    ToDataType::check_type_precision(to_precision);
147
148
4.21k
                    to_scale = to_decimal_type->get_scale();
149
4.21k
                    ToDataType::check_type_scale(to_scale);
150
4.21k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || 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.21k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
4.21k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
4.21k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
4.21k
                if (to_scale > from_scale) {
161
160
                    multiply_may_overflow &=
162
160
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
160
                }
164
4.21k
                return narrow_integral || multiply_may_overflow;
165
4.21k
            }
166
0
            return false;
167
4.21k
        });
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
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
145
                    multiply_may_overflow &=
162
145
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
145
                }
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_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
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
111
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
111
                using FromFieldType = typename FromDataType::FieldType;
124
111
                using ToFieldType = typename ToDataType::FieldType;
125
111
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
111
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
111
                UInt32 to_max_digits = 0;
137
111
                UInt32 to_precision = 0;
138
111
                UInt32 to_scale = 0;
139
140
111
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
111
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
111
                    const auto* to_decimal_type =
144
111
                            check_and_get_data_type<ToDataType>(to_type.get());
145
111
                    to_precision = to_decimal_type->get_precision();
146
111
                    ToDataType::check_type_precision(to_precision);
147
148
111
                    to_scale = to_decimal_type->get_scale();
149
111
                    ToDataType::check_type_scale(to_scale);
150
111
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
111
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
111
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
111
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
111
                if (to_scale > from_scale) {
161
79
                    multiply_may_overflow &=
162
79
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
79
                }
164
111
                return narrow_integral || multiply_may_overflow;
165
111
            }
166
0
            return false;
167
111
        });
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
389
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
389
            using Types2 = std::decay_t<decltype(types2)>;
116
389
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
389
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
389
                using FromFieldType = typename FromDataType::FieldType;
124
389
                using ToFieldType = typename ToDataType::FieldType;
125
389
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
389
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
389
                UInt32 to_max_digits = 0;
137
389
                UInt32 to_precision = 0;
138
389
                UInt32 to_scale = 0;
139
140
389
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
389
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
389
                    const auto* to_decimal_type =
144
389
                            check_and_get_data_type<ToDataType>(to_type.get());
145
389
                    to_precision = to_decimal_type->get_precision();
146
389
                    ToDataType::check_type_precision(to_precision);
147
148
389
                    to_scale = to_decimal_type->get_scale();
149
389
                    ToDataType::check_type_scale(to_scale);
150
389
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
389
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
389
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
389
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
389
                if (to_scale > from_scale) {
161
351
                    multiply_may_overflow &=
162
351
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
351
                }
164
389
                return narrow_integral || multiply_may_overflow;
165
389
            }
166
0
            return false;
167
389
        });
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.50k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.50k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.50k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
2.50k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
2.50k
                using FromFieldType = typename FromDataType::FieldType;
124
2.50k
                using ToFieldType = typename ToDataType::FieldType;
125
2.50k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
2.50k
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
2.50k
                UInt32 to_max_digits = 0;
137
2.50k
                UInt32 to_precision = 0;
138
2.50k
                UInt32 to_scale = 0;
139
140
2.50k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
2.50k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
2.50k
                    const auto* to_decimal_type =
144
2.50k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
2.50k
                    to_precision = to_decimal_type->get_precision();
146
2.50k
                    ToDataType::check_type_precision(to_precision);
147
148
2.50k
                    to_scale = to_decimal_type->get_scale();
149
2.50k
                    ToDataType::check_type_scale(to_scale);
150
2.50k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
2.50k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
2.50k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
2.50k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
2.50k
                if (to_scale > from_scale) {
161
621
                    multiply_may_overflow &=
162
621
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
621
                }
164
2.50k
                return narrow_integral || multiply_may_overflow;
165
2.50k
            }
166
0
            return false;
167
2.50k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_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
621
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
621
            using Types2 = std::decay_t<decltype(types2)>;
116
621
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
621
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
621
                using FromFieldType = typename FromDataType::FieldType;
124
621
                using ToFieldType = typename ToDataType::FieldType;
125
621
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
621
                UInt32 from_scale = 0;
127
128
621
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
621
                    const auto* from_decimal_type =
130
621
                            check_and_get_data_type<FromDataType>(from_type.get());
131
621
                    from_precision =
132
621
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
621
                    from_scale = from_decimal_type->get_scale();
134
621
                }
135
136
621
                UInt32 to_max_digits = 0;
137
621
                UInt32 to_precision = 0;
138
621
                UInt32 to_scale = 0;
139
140
621
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
621
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
621
                    const auto* to_decimal_type =
144
621
                            check_and_get_data_type<ToDataType>(to_type.get());
145
621
                    to_precision = to_decimal_type->get_precision();
146
621
                    ToDataType::check_type_precision(to_precision);
147
148
621
                    to_scale = to_decimal_type->get_scale();
149
621
                    ToDataType::check_type_scale(to_scale);
150
621
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
621
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
621
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
621
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
621
                if (to_scale > from_scale) {
161
468
                    multiply_may_overflow &=
162
468
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
468
                }
164
621
                return narrow_integral || multiply_may_overflow;
165
621
            }
166
0
            return false;
167
621
        });
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
470
                    multiply_may_overflow &=
162
470
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
470
                }
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
256
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
256
            using Types2 = std::decay_t<decltype(types2)>;
116
256
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
256
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
256
                using FromFieldType = typename FromDataType::FieldType;
124
256
                using ToFieldType = typename ToDataType::FieldType;
125
256
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
256
                UInt32 from_scale = 0;
127
128
256
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
256
                    const auto* from_decimal_type =
130
256
                            check_and_get_data_type<FromDataType>(from_type.get());
131
256
                    from_precision =
132
256
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
256
                    from_scale = from_decimal_type->get_scale();
134
256
                }
135
136
256
                UInt32 to_max_digits = 0;
137
256
                UInt32 to_precision = 0;
138
256
                UInt32 to_scale = 0;
139
140
256
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
256
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
256
                    const auto* to_decimal_type =
144
256
                            check_and_get_data_type<ToDataType>(to_type.get());
145
256
                    to_precision = to_decimal_type->get_precision();
146
256
                    ToDataType::check_type_precision(to_precision);
147
148
256
                    to_scale = to_decimal_type->get_scale();
149
256
                    ToDataType::check_type_scale(to_scale);
150
256
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
256
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
256
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
256
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
256
                if (to_scale > from_scale) {
161
71
                    multiply_may_overflow &=
162
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
71
                }
164
256
                return narrow_integral || multiply_may_overflow;
165
256
            }
166
0
            return false;
167
256
        });
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.99k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.99k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.99k
            using FromDataType = typename 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.99k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1.99k
                using FromFieldType = typename FromDataType::FieldType;
124
1.99k
                using ToFieldType = typename ToDataType::FieldType;
125
1.99k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1.99k
                UInt32 from_scale = 0;
127
128
1.99k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
1.99k
                    const auto* from_decimal_type =
130
1.99k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
1.99k
                    from_precision =
132
1.99k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
1.99k
                    from_scale = from_decimal_type->get_scale();
134
1.99k
                }
135
136
1.99k
                UInt32 to_max_digits = 0;
137
1.99k
                UInt32 to_precision = 0;
138
1.99k
                UInt32 to_scale = 0;
139
140
1.99k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1.99k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1.99k
                    const auto* to_decimal_type =
144
1.99k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1.99k
                    to_precision = to_decimal_type->get_precision();
146
1.99k
                    ToDataType::check_type_precision(to_precision);
147
148
1.99k
                    to_scale = to_decimal_type->get_scale();
149
1.99k
                    ToDataType::check_type_scale(to_scale);
150
1.99k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || 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.99k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1.99k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1.99k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1.99k
                if (to_scale > from_scale) {
161
561
                    multiply_may_overflow &=
162
561
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
561
                }
164
1.99k
                return narrow_integral || multiply_may_overflow;
165
1.99k
            }
166
0
            return false;
167
1.99k
        });
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.29k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
4.29k
            using Types2 = std::decay_t<decltype(types2)>;
116
4.29k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
4.29k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
4.29k
                return false;
121
4.29k
            }
122
4.29k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
4.29k
                using FromFieldType = typename FromDataType::FieldType;
124
4.29k
                using ToFieldType = typename ToDataType::FieldType;
125
4.29k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
4.29k
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_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.29k
                UInt32 to_max_digits = 0;
137
4.29k
                UInt32 to_precision = 0;
138
4.29k
                UInt32 to_scale = 0;
139
140
4.29k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
4.29k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
4.29k
                    const auto* to_decimal_type =
144
4.29k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
4.29k
                    to_precision = to_decimal_type->get_precision();
146
4.29k
                    ToDataType::check_type_precision(to_precision);
147
148
4.29k
                    to_scale = to_decimal_type->get_scale();
149
4.29k
                    ToDataType::check_type_scale(to_scale);
150
4.29k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || 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.29k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
4.29k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
4.29k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
4.29k
                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.29k
                return narrow_integral || multiply_may_overflow;
165
4.29k
            }
166
0
            return false;
167
4.29k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
114
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7
            using Types2 = std::decay_t<decltype(types2)>;
116
7
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
7
                using FromFieldType = typename FromDataType::FieldType;
124
7
                using ToFieldType = typename ToDataType::FieldType;
125
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
7
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
7
                UInt32 to_max_digits = 0;
137
7
                UInt32 to_precision = 0;
138
7
                UInt32 to_scale = 0;
139
140
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
7
                    const auto* to_decimal_type =
144
7
                            check_and_get_data_type<ToDataType>(to_type.get());
145
7
                    to_precision = to_decimal_type->get_precision();
146
7
                    ToDataType::check_type_precision(to_precision);
147
148
7
                    to_scale = to_decimal_type->get_scale();
149
7
                    ToDataType::check_type_scale(to_scale);
150
7
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
7
                if (to_scale > from_scale) {
161
6
                    multiply_may_overflow &=
162
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
6
                }
164
7
                return narrow_integral || multiply_may_overflow;
165
7
            }
166
0
            return false;
167
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
114
106
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
106
            using Types2 = std::decay_t<decltype(types2)>;
116
106
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
106
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
106
                using FromFieldType = typename FromDataType::FieldType;
124
106
                using ToFieldType = typename ToDataType::FieldType;
125
106
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
106
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
106
                UInt32 to_max_digits = 0;
137
106
                UInt32 to_precision = 0;
138
106
                UInt32 to_scale = 0;
139
140
106
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
106
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
106
                    const auto* to_decimal_type =
144
106
                            check_and_get_data_type<ToDataType>(to_type.get());
145
106
                    to_precision = to_decimal_type->get_precision();
146
106
                    ToDataType::check_type_precision(to_precision);
147
148
106
                    to_scale = to_decimal_type->get_scale();
149
106
                    ToDataType::check_type_scale(to_scale);
150
106
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
106
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
106
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
106
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
106
                if (to_scale > from_scale) {
161
73
                    multiply_may_overflow &=
162
73
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
73
                }
164
106
                return narrow_integral || multiply_may_overflow;
165
106
            }
166
0
            return false;
167
106
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
114
104
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
104
            using Types2 = std::decay_t<decltype(types2)>;
116
104
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
104
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
104
                using FromFieldType = typename FromDataType::FieldType;
124
104
                using ToFieldType = typename ToDataType::FieldType;
125
104
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
104
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
104
                UInt32 to_max_digits = 0;
137
104
                UInt32 to_precision = 0;
138
104
                UInt32 to_scale = 0;
139
140
104
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
104
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
104
                    const auto* to_decimal_type =
144
104
                            check_and_get_data_type<ToDataType>(to_type.get());
145
104
                    to_precision = to_decimal_type->get_precision();
146
104
                    ToDataType::check_type_precision(to_precision);
147
148
104
                    to_scale = to_decimal_type->get_scale();
149
104
                    ToDataType::check_type_scale(to_scale);
150
104
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
104
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
104
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
104
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
104
                if (to_scale > from_scale) {
161
71
                    multiply_may_overflow &=
162
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
71
                }
164
104
                return narrow_integral || multiply_may_overflow;
165
104
            }
166
0
            return false;
167
104
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
114
122
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
122
            using Types2 = std::decay_t<decltype(types2)>;
116
122
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
122
                using FromFieldType = typename FromDataType::FieldType;
124
122
                using ToFieldType = typename ToDataType::FieldType;
125
122
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
122
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
122
                UInt32 to_max_digits = 0;
137
122
                UInt32 to_precision = 0;
138
122
                UInt32 to_scale = 0;
139
140
122
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
122
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
122
                    const auto* to_decimal_type =
144
122
                            check_and_get_data_type<ToDataType>(to_type.get());
145
122
                    to_precision = to_decimal_type->get_precision();
146
122
                    ToDataType::check_type_precision(to_precision);
147
148
122
                    to_scale = to_decimal_type->get_scale();
149
122
                    ToDataType::check_type_scale(to_scale);
150
122
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
122
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
122
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
122
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
122
                if (to_scale > from_scale) {
161
84
                    multiply_may_overflow &=
162
84
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
84
                }
164
122
                return narrow_integral || multiply_may_overflow;
165
122
            }
166
0
            return false;
167
122
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
114
104
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
104
            using Types2 = std::decay_t<decltype(types2)>;
116
104
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
104
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
104
                using FromFieldType = typename FromDataType::FieldType;
124
104
                using ToFieldType = typename ToDataType::FieldType;
125
104
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
104
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
104
                UInt32 to_max_digits = 0;
137
104
                UInt32 to_precision = 0;
138
104
                UInt32 to_scale = 0;
139
140
104
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
104
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
104
                    const auto* to_decimal_type =
144
104
                            check_and_get_data_type<ToDataType>(to_type.get());
145
104
                    to_precision = to_decimal_type->get_precision();
146
104
                    ToDataType::check_type_precision(to_precision);
147
148
104
                    to_scale = to_decimal_type->get_scale();
149
104
                    ToDataType::check_type_scale(to_scale);
150
104
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
104
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
104
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
104
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
104
                if (to_scale > from_scale) {
161
71
                    multiply_may_overflow &=
162
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
71
                }
164
104
                return narrow_integral || multiply_may_overflow;
165
104
            }
166
0
            return false;
167
104
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
114
166
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
166
            using Types2 = std::decay_t<decltype(types2)>;
116
166
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
166
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
166
                using FromFieldType = typename FromDataType::FieldType;
124
166
                using ToFieldType = typename ToDataType::FieldType;
125
166
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
166
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
166
                UInt32 to_max_digits = 0;
137
166
                UInt32 to_precision = 0;
138
166
                UInt32 to_scale = 0;
139
140
166
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
166
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
166
                    const auto* to_decimal_type =
144
166
                            check_and_get_data_type<ToDataType>(to_type.get());
145
166
                    to_precision = to_decimal_type->get_precision();
146
166
                    ToDataType::check_type_precision(to_precision);
147
148
166
                    to_scale = to_decimal_type->get_scale();
149
166
                    ToDataType::check_type_scale(to_scale);
150
166
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
166
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
166
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
166
                if (to_scale > from_scale) {
161
122
                    multiply_may_overflow &=
162
122
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
122
                }
164
166
                return narrow_integral || multiply_may_overflow;
165
166
            }
166
0
            return false;
167
166
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
114
180
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
180
            using Types2 = std::decay_t<decltype(types2)>;
116
180
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
180
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
180
                using FromFieldType = typename FromDataType::FieldType;
124
180
                using ToFieldType = typename ToDataType::FieldType;
125
180
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
180
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
180
                UInt32 to_max_digits = 0;
137
180
                UInt32 to_precision = 0;
138
180
                UInt32 to_scale = 0;
139
140
180
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
180
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
180
                    const auto* to_decimal_type =
144
180
                            check_and_get_data_type<ToDataType>(to_type.get());
145
180
                    to_precision = to_decimal_type->get_precision();
146
180
                    ToDataType::check_type_precision(to_precision);
147
148
180
                    to_scale = to_decimal_type->get_scale();
149
180
                    ToDataType::check_type_scale(to_scale);
150
180
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
180
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
180
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
180
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
180
                if (to_scale > from_scale) {
161
114
                    multiply_may_overflow &=
162
114
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
114
                }
164
180
                return narrow_integral || multiply_may_overflow;
165
180
            }
166
0
            return false;
167
180
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
114
276
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
276
            using Types2 = std::decay_t<decltype(types2)>;
116
276
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
276
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
276
                using FromFieldType = typename FromDataType::FieldType;
124
276
                using ToFieldType = typename ToDataType::FieldType;
125
276
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
276
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
276
                UInt32 to_max_digits = 0;
137
276
                UInt32 to_precision = 0;
138
276
                UInt32 to_scale = 0;
139
140
276
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
276
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
276
                    const auto* to_decimal_type =
144
276
                            check_and_get_data_type<ToDataType>(to_type.get());
145
276
                    to_precision = to_decimal_type->get_precision();
146
276
                    ToDataType::check_type_precision(to_precision);
147
148
276
                    to_scale = to_decimal_type->get_scale();
149
276
                    ToDataType::check_type_scale(to_scale);
150
276
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
276
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
276
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
276
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
276
                if (to_scale > from_scale) {
161
196
                    multiply_may_overflow &=
162
196
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
196
                }
164
276
                return narrow_integral || multiply_may_overflow;
165
276
            }
166
0
            return false;
167
276
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
114
429
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
429
            using Types2 = std::decay_t<decltype(types2)>;
116
429
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
429
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
429
                using FromFieldType = typename FromDataType::FieldType;
124
429
                using ToFieldType = typename ToDataType::FieldType;
125
429
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
429
                UInt32 from_scale = 0;
127
128
429
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
429
                    const auto* from_decimal_type =
130
429
                            check_and_get_data_type<FromDataType>(from_type.get());
131
429
                    from_precision =
132
429
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
429
                    from_scale = from_decimal_type->get_scale();
134
429
                }
135
136
429
                UInt32 to_max_digits = 0;
137
429
                UInt32 to_precision = 0;
138
429
                UInt32 to_scale = 0;
139
140
429
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
429
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
429
                    const auto* to_decimal_type =
144
429
                            check_and_get_data_type<ToDataType>(to_type.get());
145
429
                    to_precision = to_decimal_type->get_precision();
146
429
                    ToDataType::check_type_precision(to_precision);
147
148
429
                    to_scale = to_decimal_type->get_scale();
149
429
                    ToDataType::check_type_scale(to_scale);
150
429
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
429
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
429
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
429
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
429
                if (to_scale > from_scale) {
161
361
                    multiply_may_overflow &=
162
361
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
361
                }
164
429
                return narrow_integral || multiply_may_overflow;
165
429
            }
166
0
            return false;
167
429
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
114
671
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
671
            using Types2 = std::decay_t<decltype(types2)>;
116
671
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
671
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
671
                using FromFieldType = typename FromDataType::FieldType;
124
671
                using ToFieldType = typename ToDataType::FieldType;
125
671
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
671
                UInt32 from_scale = 0;
127
128
671
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
671
                    const auto* from_decimal_type =
130
671
                            check_and_get_data_type<FromDataType>(from_type.get());
131
671
                    from_precision =
132
671
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
671
                    from_scale = from_decimal_type->get_scale();
134
671
                }
135
136
671
                UInt32 to_max_digits = 0;
137
671
                UInt32 to_precision = 0;
138
671
                UInt32 to_scale = 0;
139
140
671
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
671
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
671
                    const auto* to_decimal_type =
144
671
                            check_and_get_data_type<ToDataType>(to_type.get());
145
671
                    to_precision = to_decimal_type->get_precision();
146
671
                    ToDataType::check_type_precision(to_precision);
147
148
671
                    to_scale = to_decimal_type->get_scale();
149
671
                    ToDataType::check_type_scale(to_scale);
150
671
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
671
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
671
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
671
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
671
                if (to_scale > from_scale) {
161
544
                    multiply_may_overflow &=
162
544
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
544
                }
164
671
                return narrow_integral || multiply_may_overflow;
165
671
            }
166
0
            return false;
167
671
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
114
148
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
148
            using Types2 = std::decay_t<decltype(types2)>;
116
148
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
148
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
148
                using FromFieldType = typename FromDataType::FieldType;
124
148
                using ToFieldType = typename ToDataType::FieldType;
125
148
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
148
                UInt32 from_scale = 0;
127
128
148
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
148
                    const auto* from_decimal_type =
130
148
                            check_and_get_data_type<FromDataType>(from_type.get());
131
148
                    from_precision =
132
148
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
148
                    from_scale = from_decimal_type->get_scale();
134
148
                }
135
136
148
                UInt32 to_max_digits = 0;
137
148
                UInt32 to_precision = 0;
138
148
                UInt32 to_scale = 0;
139
140
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
148
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
148
                    const auto* to_decimal_type =
144
148
                            check_and_get_data_type<ToDataType>(to_type.get());
145
148
                    to_precision = to_decimal_type->get_precision();
146
148
                    ToDataType::check_type_precision(to_precision);
147
148
148
                    to_scale = to_decimal_type->get_scale();
149
148
                    ToDataType::check_type_scale(to_scale);
150
148
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
148
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
148
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
148
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
148
                if (to_scale > from_scale) {
161
84
                    multiply_may_overflow &=
162
84
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
84
                }
164
148
                return narrow_integral || multiply_may_overflow;
165
148
            }
166
0
            return false;
167
148
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
114
966
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
966
            using Types2 = std::decay_t<decltype(types2)>;
116
966
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
966
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
966
                using FromFieldType = typename FromDataType::FieldType;
124
966
                using ToFieldType = typename ToDataType::FieldType;
125
966
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
966
                UInt32 from_scale = 0;
127
128
966
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
966
                    const auto* from_decimal_type =
130
966
                            check_and_get_data_type<FromDataType>(from_type.get());
131
966
                    from_precision =
132
966
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
966
                    from_scale = from_decimal_type->get_scale();
134
966
                }
135
136
966
                UInt32 to_max_digits = 0;
137
966
                UInt32 to_precision = 0;
138
966
                UInt32 to_scale = 0;
139
140
966
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
966
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
966
                    const auto* to_decimal_type =
144
966
                            check_and_get_data_type<ToDataType>(to_type.get());
145
966
                    to_precision = to_decimal_type->get_precision();
146
966
                    ToDataType::check_type_precision(to_precision);
147
148
966
                    to_scale = to_decimal_type->get_scale();
149
966
                    ToDataType::check_type_scale(to_scale);
150
966
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
966
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
966
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
966
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
966
                if (to_scale > from_scale) {
161
511
                    multiply_may_overflow &=
162
511
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
511
                }
164
966
                return narrow_integral || multiply_may_overflow;
165
966
            }
166
0
            return false;
167
966
        });
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
687
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
687
            using Types2 = std::decay_t<decltype(types2)>;
116
687
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
687
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
687
                using FromFieldType = typename FromDataType::FieldType;
124
687
                using ToFieldType = typename ToDataType::FieldType;
125
687
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
687
                UInt32 from_scale = 0;
127
128
687
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
687
                    const auto* from_decimal_type =
130
687
                            check_and_get_data_type<FromDataType>(from_type.get());
131
687
                    from_precision =
132
687
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
687
                    from_scale = from_decimal_type->get_scale();
134
687
                }
135
136
687
                UInt32 to_max_digits = 0;
137
687
                UInt32 to_precision = 0;
138
687
                UInt32 to_scale = 0;
139
140
687
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
687
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
687
                    const auto* to_decimal_type =
144
687
                            check_and_get_data_type<ToDataType>(to_type.get());
145
687
                    to_precision = to_decimal_type->get_precision();
146
687
                    ToDataType::check_type_precision(to_precision);
147
148
687
                    to_scale = to_decimal_type->get_scale();
149
687
                    ToDataType::check_type_scale(to_scale);
150
687
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
687
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
687
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
687
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
687
                if (to_scale > from_scale) {
161
333
                    multiply_may_overflow &=
162
333
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
333
                }
164
687
                return narrow_integral || multiply_may_overflow;
165
687
            }
166
0
            return false;
167
687
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
114
3.57k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3.57k
            using Types2 = std::decay_t<decltype(types2)>;
116
3.57k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
3.57k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
3.57k
                return false;
121
3.57k
            }
122
3.57k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
3.57k
                using FromFieldType = typename FromDataType::FieldType;
124
3.57k
                using ToFieldType = typename ToDataType::FieldType;
125
3.57k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
3.57k
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
3.57k
                UInt32 to_max_digits = 0;
137
3.57k
                UInt32 to_precision = 0;
138
3.57k
                UInt32 to_scale = 0;
139
140
3.57k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
3.57k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
3.57k
                    const auto* to_decimal_type =
144
3.57k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
3.57k
                    to_precision = to_decimal_type->get_precision();
146
3.57k
                    ToDataType::check_type_precision(to_precision);
147
148
3.57k
                    to_scale = to_decimal_type->get_scale();
149
3.57k
                    ToDataType::check_type_scale(to_scale);
150
3.57k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
3.57k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
3.57k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
3.57k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
3.57k
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
3.57k
                return narrow_integral || multiply_may_overflow;
165
3.57k
            }
166
0
            return false;
167
3.57k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Line
Count
Source
114
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1
            using Types2 = std::decay_t<decltype(types2)>;
116
1
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1
            return false;
167
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
114
3
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3
            using Types2 = std::decay_t<decltype(types2)>;
116
3
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
3
            return false;
167
3
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
114
26
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
26
            using Types2 = std::decay_t<decltype(types2)>;
116
26
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
26
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
26
                return false;
121
26
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
26
            return false;
167
26
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Line
Count
Source
114
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
10
            using Types2 = std::decay_t<decltype(types2)>;
116
10
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
10
            return false;
167
10
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
114
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7
            using Types2 = std::decay_t<decltype(types2)>;
116
7
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
7
            return false;
167
7
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
114
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7
            using Types2 = std::decay_t<decltype(types2)>;
116
7
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
7
            return false;
167
7
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Line
Count
Source
114
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2
            using Types2 = std::decay_t<decltype(types2)>;
116
2
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
2
                using FromFieldType = typename FromDataType::FieldType;
124
2
                using ToFieldType = typename ToDataType::FieldType;
125
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
2
                UInt32 from_scale = 0;
127
128
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
2
                    const auto* from_decimal_type =
130
2
                            check_and_get_data_type<FromDataType>(from_type.get());
131
2
                    from_precision =
132
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
2
                    from_scale = from_decimal_type->get_scale();
134
2
                }
135
136
2
                UInt32 to_max_digits = 0;
137
2
                UInt32 to_precision = 0;
138
2
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
2
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
2
                return narrow_integral || multiply_may_overflow;
165
2
            }
166
0
            return false;
167
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Line
Count
Source
114
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
220
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
220
            using Types2 = std::decay_t<decltype(types2)>;
116
220
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
220
            return false;
167
220
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
114
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1
            using Types2 = std::decay_t<decltype(types2)>;
116
1
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
1
            return false;
167
1
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Line
Count
Source
114
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2
            using Types2 = std::decay_t<decltype(types2)>;
116
2
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
2
            return false;
167
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
114
5.36k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
5.36k
            using Types2 = std::decay_t<decltype(types2)>;
116
5.36k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
5.36k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
5.36k
                return false;
121
5.36k
            }
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.36k
            return false;
167
5.36k
        });
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
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
        });
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
384
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
384
            using Types2 = std::decay_t<decltype(types2)>;
116
384
            using FromDataType = typename 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
384
            return false;
167
384
        });
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
108
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
108
            using Types2 = std::decay_t<decltype(types2)>;
116
108
            using FromDataType = typename 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
108
            return false;
167
108
        });
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.94k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.94k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.94k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
2.94k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
2.94k
                return false;
121
2.94k
            }
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.94k
            return false;
167
2.94k
        });
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
214k
    };
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.77k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
4.77k
        using Types = std::decay_t<decltype(types)>;
106
4.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
4.77k
        return call_on_index_and_data_type<
114
4.77k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
4.77k
            using Types2 = std::decay_t<decltype(types2)>;
116
4.77k
            using FromDataType = typename Types2::LeftType;
117
4.77k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
4.77k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
4.77k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
4.77k
                return false;
121
4.77k
            }
122
4.77k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
4.77k
                using FromFieldType = typename FromDataType::FieldType;
124
4.77k
                using ToFieldType = typename ToDataType::FieldType;
125
4.77k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
4.77k
                UInt32 from_scale = 0;
127
128
4.77k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
4.77k
                    const auto* from_decimal_type =
130
4.77k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
4.77k
                    from_precision =
132
4.77k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
4.77k
                    from_scale = from_decimal_type->get_scale();
134
4.77k
                }
135
136
4.77k
                UInt32 to_max_digits = 0;
137
4.77k
                UInt32 to_precision = 0;
138
4.77k
                UInt32 to_scale = 0;
139
140
4.77k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
4.77k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
4.77k
                    const auto* to_decimal_type =
144
4.77k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
4.77k
                    to_precision = to_decimal_type->get_precision();
146
4.77k
                    ToDataType::check_type_precision(to_precision);
147
148
4.77k
                    to_scale = to_decimal_type->get_scale();
149
4.77k
                    ToDataType::check_type_scale(to_scale);
150
4.77k
                }
151
4.77k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
4.77k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
4.77k
                    to_precision = to_max_digits;
154
4.77k
                }
155
156
4.77k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
4.77k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
4.77k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
4.77k
                if (to_scale > from_scale) {
161
4.77k
                    multiply_may_overflow &=
162
4.77k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
4.77k
                }
164
4.77k
                return narrow_integral || multiply_may_overflow;
165
4.77k
            }
166
4.77k
            return false;
167
4.77k
        });
168
4.77k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
104
5.31k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
5.31k
        using Types = std::decay_t<decltype(types)>;
106
5.31k
        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.31k
        return call_on_index_and_data_type<
114
5.31k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
5.31k
            using Types2 = std::decay_t<decltype(types2)>;
116
5.31k
            using FromDataType = typename Types2::LeftType;
117
5.31k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
5.31k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
5.31k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
5.31k
                return false;
121
5.31k
            }
122
5.31k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
5.31k
                using FromFieldType = typename FromDataType::FieldType;
124
5.31k
                using ToFieldType = typename ToDataType::FieldType;
125
5.31k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
5.31k
                UInt32 from_scale = 0;
127
128
5.31k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
5.31k
                    const auto* from_decimal_type =
130
5.31k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
5.31k
                    from_precision =
132
5.31k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
5.31k
                    from_scale = from_decimal_type->get_scale();
134
5.31k
                }
135
136
5.31k
                UInt32 to_max_digits = 0;
137
5.31k
                UInt32 to_precision = 0;
138
5.31k
                UInt32 to_scale = 0;
139
140
5.31k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
5.31k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
5.31k
                    const auto* to_decimal_type =
144
5.31k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
5.31k
                    to_precision = to_decimal_type->get_precision();
146
5.31k
                    ToDataType::check_type_precision(to_precision);
147
148
5.31k
                    to_scale = to_decimal_type->get_scale();
149
5.31k
                    ToDataType::check_type_scale(to_scale);
150
5.31k
                }
151
5.31k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
5.31k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
5.31k
                    to_precision = to_max_digits;
154
5.31k
                }
155
156
5.31k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
5.31k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
5.31k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
5.31k
                if (to_scale > from_scale) {
161
5.31k
                    multiply_may_overflow &=
162
5.31k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
5.31k
                }
164
5.31k
                return narrow_integral || multiply_may_overflow;
165
5.31k
            }
166
5.31k
            return false;
167
5.31k
        });
168
5.31k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
104
32.3k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
32.3k
        using Types = std::decay_t<decltype(types)>;
106
32.3k
        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
32.3k
        return call_on_index_and_data_type<
114
32.3k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
32.3k
            using Types2 = std::decay_t<decltype(types2)>;
116
32.3k
            using FromDataType = typename Types2::LeftType;
117
32.3k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
32.3k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
32.3k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
32.3k
                return false;
121
32.3k
            }
122
32.3k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
32.3k
                using FromFieldType = typename FromDataType::FieldType;
124
32.3k
                using ToFieldType = typename ToDataType::FieldType;
125
32.3k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
32.3k
                UInt32 from_scale = 0;
127
128
32.3k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
32.3k
                    const auto* from_decimal_type =
130
32.3k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
32.3k
                    from_precision =
132
32.3k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
32.3k
                    from_scale = from_decimal_type->get_scale();
134
32.3k
                }
135
136
32.3k
                UInt32 to_max_digits = 0;
137
32.3k
                UInt32 to_precision = 0;
138
32.3k
                UInt32 to_scale = 0;
139
140
32.3k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
32.3k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
32.3k
                    const auto* to_decimal_type =
144
32.3k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
32.3k
                    to_precision = to_decimal_type->get_precision();
146
32.3k
                    ToDataType::check_type_precision(to_precision);
147
148
32.3k
                    to_scale = to_decimal_type->get_scale();
149
32.3k
                    ToDataType::check_type_scale(to_scale);
150
32.3k
                }
151
32.3k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
32.3k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
32.3k
                    to_precision = to_max_digits;
154
32.3k
                }
155
156
32.3k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
32.3k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
32.3k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
32.3k
                if (to_scale > from_scale) {
161
32.3k
                    multiply_may_overflow &=
162
32.3k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
32.3k
                }
164
32.3k
                return narrow_integral || multiply_may_overflow;
165
32.3k
            }
166
32.3k
            return false;
167
32.3k
        });
168
32.3k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
104
38.6k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
38.6k
        using Types = std::decay_t<decltype(types)>;
106
38.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
38.6k
        return call_on_index_and_data_type<
114
38.6k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
38.6k
            using Types2 = std::decay_t<decltype(types2)>;
116
38.6k
            using FromDataType = typename Types2::LeftType;
117
38.6k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
38.6k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
38.6k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
38.6k
                return false;
121
38.6k
            }
122
38.6k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
38.6k
                using FromFieldType = typename FromDataType::FieldType;
124
38.6k
                using ToFieldType = typename ToDataType::FieldType;
125
38.6k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
38.6k
                UInt32 from_scale = 0;
127
128
38.6k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
38.6k
                    const auto* from_decimal_type =
130
38.6k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
38.6k
                    from_precision =
132
38.6k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
38.6k
                    from_scale = from_decimal_type->get_scale();
134
38.6k
                }
135
136
38.6k
                UInt32 to_max_digits = 0;
137
38.6k
                UInt32 to_precision = 0;
138
38.6k
                UInt32 to_scale = 0;
139
140
38.6k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
38.6k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
38.6k
                    const auto* to_decimal_type =
144
38.6k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
38.6k
                    to_precision = to_decimal_type->get_precision();
146
38.6k
                    ToDataType::check_type_precision(to_precision);
147
148
38.6k
                    to_scale = to_decimal_type->get_scale();
149
38.6k
                    ToDataType::check_type_scale(to_scale);
150
38.6k
                }
151
38.6k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
38.6k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
38.6k
                    to_precision = to_max_digits;
154
38.6k
                }
155
156
38.6k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
38.6k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
38.6k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
38.6k
                if (to_scale > from_scale) {
161
38.6k
                    multiply_may_overflow &=
162
38.6k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
38.6k
                }
164
38.6k
                return narrow_integral || multiply_may_overflow;
165
38.6k
            }
166
38.6k
            return false;
167
38.6k
        });
168
38.6k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
104
4.61k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
4.61k
        using Types = std::decay_t<decltype(types)>;
106
4.61k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
4.61k
        return call_on_index_and_data_type<
114
4.61k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
4.61k
            using Types2 = std::decay_t<decltype(types2)>;
116
4.61k
            using FromDataType = typename Types2::LeftType;
117
4.61k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
4.61k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
4.61k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
4.61k
                return false;
121
4.61k
            }
122
4.61k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
4.61k
                using FromFieldType = typename FromDataType::FieldType;
124
4.61k
                using ToFieldType = typename ToDataType::FieldType;
125
4.61k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
4.61k
                UInt32 from_scale = 0;
127
128
4.61k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
4.61k
                    const auto* from_decimal_type =
130
4.61k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
4.61k
                    from_precision =
132
4.61k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
4.61k
                    from_scale = from_decimal_type->get_scale();
134
4.61k
                }
135
136
4.61k
                UInt32 to_max_digits = 0;
137
4.61k
                UInt32 to_precision = 0;
138
4.61k
                UInt32 to_scale = 0;
139
140
4.61k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
4.61k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
4.61k
                    const auto* to_decimal_type =
144
4.61k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
4.61k
                    to_precision = to_decimal_type->get_precision();
146
4.61k
                    ToDataType::check_type_precision(to_precision);
147
148
4.61k
                    to_scale = to_decimal_type->get_scale();
149
4.61k
                    ToDataType::check_type_scale(to_scale);
150
4.61k
                }
151
4.61k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
4.61k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
4.61k
                    to_precision = to_max_digits;
154
4.61k
                }
155
156
4.61k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
4.61k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
4.61k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
4.61k
                if (to_scale > from_scale) {
161
4.61k
                    multiply_may_overflow &=
162
4.61k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
4.61k
                }
164
4.61k
                return narrow_integral || multiply_may_overflow;
165
4.61k
            }
166
4.61k
            return false;
167
4.61k
        });
168
4.61k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
104
10.0k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
10.0k
        using Types = std::decay_t<decltype(types)>;
106
10.0k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
10.0k
        return call_on_index_and_data_type<
114
10.0k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
10.0k
            using Types2 = std::decay_t<decltype(types2)>;
116
10.0k
            using FromDataType = typename Types2::LeftType;
117
10.0k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
10.0k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
10.0k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
10.0k
                return false;
121
10.0k
            }
122
10.0k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
10.0k
                using FromFieldType = typename FromDataType::FieldType;
124
10.0k
                using ToFieldType = typename ToDataType::FieldType;
125
10.0k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
10.0k
                UInt32 from_scale = 0;
127
128
10.0k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
10.0k
                    const auto* from_decimal_type =
130
10.0k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
10.0k
                    from_precision =
132
10.0k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
10.0k
                    from_scale = from_decimal_type->get_scale();
134
10.0k
                }
135
136
10.0k
                UInt32 to_max_digits = 0;
137
10.0k
                UInt32 to_precision = 0;
138
10.0k
                UInt32 to_scale = 0;
139
140
10.0k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
10.0k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
10.0k
                    const auto* to_decimal_type =
144
10.0k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
10.0k
                    to_precision = to_decimal_type->get_precision();
146
10.0k
                    ToDataType::check_type_precision(to_precision);
147
148
10.0k
                    to_scale = to_decimal_type->get_scale();
149
10.0k
                    ToDataType::check_type_scale(to_scale);
150
10.0k
                }
151
10.0k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
10.0k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
10.0k
                    to_precision = to_max_digits;
154
10.0k
                }
155
156
10.0k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
10.0k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
10.0k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
10.0k
                if (to_scale > from_scale) {
161
10.0k
                    multiply_may_overflow &=
162
10.0k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
10.0k
                }
164
10.0k
                return narrow_integral || multiply_may_overflow;
165
10.0k
            }
166
10.0k
            return false;
167
10.0k
        });
168
10.0k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
104
25.4k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
25.4k
        using Types = std::decay_t<decltype(types)>;
106
25.4k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
25.4k
        return call_on_index_and_data_type<
114
25.4k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
25.4k
            using Types2 = std::decay_t<decltype(types2)>;
116
25.4k
            using FromDataType = typename Types2::LeftType;
117
25.4k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
25.4k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
25.4k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
25.4k
                return false;
121
25.4k
            }
122
25.4k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
25.4k
                using FromFieldType = typename FromDataType::FieldType;
124
25.4k
                using ToFieldType = typename ToDataType::FieldType;
125
25.4k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
25.4k
                UInt32 from_scale = 0;
127
128
25.4k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
25.4k
                    const auto* from_decimal_type =
130
25.4k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
25.4k
                    from_precision =
132
25.4k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
25.4k
                    from_scale = from_decimal_type->get_scale();
134
25.4k
                }
135
136
25.4k
                UInt32 to_max_digits = 0;
137
25.4k
                UInt32 to_precision = 0;
138
25.4k
                UInt32 to_scale = 0;
139
140
25.4k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
25.4k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
25.4k
                    const auto* to_decimal_type =
144
25.4k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
25.4k
                    to_precision = to_decimal_type->get_precision();
146
25.4k
                    ToDataType::check_type_precision(to_precision);
147
148
25.4k
                    to_scale = to_decimal_type->get_scale();
149
25.4k
                    ToDataType::check_type_scale(to_scale);
150
25.4k
                }
151
25.4k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
25.4k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
25.4k
                    to_precision = to_max_digits;
154
25.4k
                }
155
156
25.4k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
25.4k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
25.4k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
25.4k
                if (to_scale > from_scale) {
161
25.4k
                    multiply_may_overflow &=
162
25.4k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
25.4k
                }
164
25.4k
                return narrow_integral || multiply_may_overflow;
165
25.4k
            }
166
25.4k
            return false;
167
25.4k
        });
168
25.4k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
104
6.81k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
6.81k
        using Types = std::decay_t<decltype(types)>;
106
6.81k
        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.81k
        return call_on_index_and_data_type<
114
6.81k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
6.81k
            using Types2 = std::decay_t<decltype(types2)>;
116
6.81k
            using FromDataType = typename Types2::LeftType;
117
6.81k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
6.81k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
6.81k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
6.81k
                return false;
121
6.81k
            }
122
6.81k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
6.81k
                using FromFieldType = typename FromDataType::FieldType;
124
6.81k
                using ToFieldType = typename ToDataType::FieldType;
125
6.81k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
6.81k
                UInt32 from_scale = 0;
127
128
6.81k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
6.81k
                    const auto* from_decimal_type =
130
6.81k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
6.81k
                    from_precision =
132
6.81k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
6.81k
                    from_scale = from_decimal_type->get_scale();
134
6.81k
                }
135
136
6.81k
                UInt32 to_max_digits = 0;
137
6.81k
                UInt32 to_precision = 0;
138
6.81k
                UInt32 to_scale = 0;
139
140
6.81k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
6.81k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
6.81k
                    const auto* to_decimal_type =
144
6.81k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
6.81k
                    to_precision = to_decimal_type->get_precision();
146
6.81k
                    ToDataType::check_type_precision(to_precision);
147
148
6.81k
                    to_scale = to_decimal_type->get_scale();
149
6.81k
                    ToDataType::check_type_scale(to_scale);
150
6.81k
                }
151
6.81k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
6.81k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
6.81k
                    to_precision = to_max_digits;
154
6.81k
                }
155
156
6.81k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
6.81k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
6.81k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
6.81k
                if (to_scale > from_scale) {
161
6.81k
                    multiply_may_overflow &=
162
6.81k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
6.81k
                }
164
6.81k
                return narrow_integral || multiply_may_overflow;
165
6.81k
            }
166
6.81k
            return false;
167
6.81k
        });
168
6.81k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
104
14.0k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
14.0k
        using Types = std::decay_t<decltype(types)>;
106
14.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
14.0k
        return call_on_index_and_data_type<
114
14.0k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
14.0k
            using Types2 = std::decay_t<decltype(types2)>;
116
14.0k
            using FromDataType = typename Types2::LeftType;
117
14.0k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
14.0k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
14.0k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
14.0k
                return false;
121
14.0k
            }
122
14.0k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
14.0k
                using FromFieldType = typename FromDataType::FieldType;
124
14.0k
                using ToFieldType = typename ToDataType::FieldType;
125
14.0k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
14.0k
                UInt32 from_scale = 0;
127
128
14.0k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
14.0k
                    const auto* from_decimal_type =
130
14.0k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
14.0k
                    from_precision =
132
14.0k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
14.0k
                    from_scale = from_decimal_type->get_scale();
134
14.0k
                }
135
136
14.0k
                UInt32 to_max_digits = 0;
137
14.0k
                UInt32 to_precision = 0;
138
14.0k
                UInt32 to_scale = 0;
139
140
14.0k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
14.0k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
14.0k
                    const auto* to_decimal_type =
144
14.0k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
14.0k
                    to_precision = to_decimal_type->get_precision();
146
14.0k
                    ToDataType::check_type_precision(to_precision);
147
148
14.0k
                    to_scale = to_decimal_type->get_scale();
149
14.0k
                    ToDataType::check_type_scale(to_scale);
150
14.0k
                }
151
14.0k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
14.0k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
14.0k
                    to_precision = to_max_digits;
154
14.0k
                }
155
156
14.0k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
14.0k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
14.0k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
14.0k
                if (to_scale > from_scale) {
161
14.0k
                    multiply_may_overflow &=
162
14.0k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
14.0k
                }
164
14.0k
                return narrow_integral || multiply_may_overflow;
165
14.0k
            }
166
14.0k
            return false;
167
14.0k
        });
168
14.0k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
104
229
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
229
        using Types = std::decay_t<decltype(types)>;
106
229
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
            return false;
112
        }
113
229
        return call_on_index_and_data_type<
114
229
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
229
            using Types2 = std::decay_t<decltype(types2)>;
116
229
            using FromDataType = typename Types2::LeftType;
117
229
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
229
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
229
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
229
                return false;
121
229
            }
122
229
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
229
                using FromFieldType = typename FromDataType::FieldType;
124
229
                using ToFieldType = typename ToDataType::FieldType;
125
229
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
229
                UInt32 from_scale = 0;
127
128
229
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
229
                    const auto* from_decimal_type =
130
229
                            check_and_get_data_type<FromDataType>(from_type.get());
131
229
                    from_precision =
132
229
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
229
                    from_scale = from_decimal_type->get_scale();
134
229
                }
135
136
229
                UInt32 to_max_digits = 0;
137
229
                UInt32 to_precision = 0;
138
229
                UInt32 to_scale = 0;
139
140
229
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
229
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
229
                    const auto* to_decimal_type =
144
229
                            check_and_get_data_type<ToDataType>(to_type.get());
145
229
                    to_precision = to_decimal_type->get_precision();
146
229
                    ToDataType::check_type_precision(to_precision);
147
148
229
                    to_scale = to_decimal_type->get_scale();
149
229
                    ToDataType::check_type_scale(to_scale);
150
229
                }
151
229
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
229
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
229
                    to_precision = to_max_digits;
154
229
                }
155
156
229
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
229
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
229
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
229
                if (to_scale > from_scale) {
161
229
                    multiply_may_overflow &=
162
229
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
229
                }
164
229
                return narrow_integral || multiply_may_overflow;
165
229
            }
166
229
            return false;
167
229
        });
168
229
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
104
13.0k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
13.0k
        using Types = std::decay_t<decltype(types)>;
106
13.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
13.0k
        return call_on_index_and_data_type<
114
13.0k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
13.0k
            using Types2 = std::decay_t<decltype(types2)>;
116
13.0k
            using FromDataType = typename Types2::LeftType;
117
13.0k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
13.0k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
13.0k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
13.0k
                return false;
121
13.0k
            }
122
13.0k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
13.0k
                using FromFieldType = typename FromDataType::FieldType;
124
13.0k
                using ToFieldType = typename ToDataType::FieldType;
125
13.0k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
13.0k
                UInt32 from_scale = 0;
127
128
13.0k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
13.0k
                    const auto* from_decimal_type =
130
13.0k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
13.0k
                    from_precision =
132
13.0k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
13.0k
                    from_scale = from_decimal_type->get_scale();
134
13.0k
                }
135
136
13.0k
                UInt32 to_max_digits = 0;
137
13.0k
                UInt32 to_precision = 0;
138
13.0k
                UInt32 to_scale = 0;
139
140
13.0k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
13.0k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
13.0k
                    const auto* to_decimal_type =
144
13.0k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
13.0k
                    to_precision = to_decimal_type->get_precision();
146
13.0k
                    ToDataType::check_type_precision(to_precision);
147
148
13.0k
                    to_scale = to_decimal_type->get_scale();
149
13.0k
                    ToDataType::check_type_scale(to_scale);
150
13.0k
                }
151
13.0k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
13.0k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
13.0k
                    to_precision = to_max_digits;
154
13.0k
                }
155
156
13.0k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
13.0k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
13.0k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
13.0k
                if (to_scale > from_scale) {
161
13.0k
                    multiply_may_overflow &=
162
13.0k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
13.0k
                }
164
13.0k
                return narrow_integral || multiply_may_overflow;
165
13.0k
            }
166
13.0k
            return false;
167
13.0k
        });
168
13.0k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_
Line
Count
Source
104
7.59k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
7.59k
        using Types = std::decay_t<decltype(types)>;
106
7.59k
        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.59k
        return call_on_index_and_data_type<
114
7.59k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
7.59k
            using Types2 = std::decay_t<decltype(types2)>;
116
7.59k
            using FromDataType = typename Types2::LeftType;
117
7.59k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
7.59k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
7.59k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
7.59k
                return false;
121
7.59k
            }
122
7.59k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
7.59k
                using FromFieldType = typename FromDataType::FieldType;
124
7.59k
                using ToFieldType = typename ToDataType::FieldType;
125
7.59k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
7.59k
                UInt32 from_scale = 0;
127
128
7.59k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
7.59k
                    const auto* from_decimal_type =
130
7.59k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
7.59k
                    from_precision =
132
7.59k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
7.59k
                    from_scale = from_decimal_type->get_scale();
134
7.59k
                }
135
136
7.59k
                UInt32 to_max_digits = 0;
137
7.59k
                UInt32 to_precision = 0;
138
7.59k
                UInt32 to_scale = 0;
139
140
7.59k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
7.59k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
7.59k
                    const auto* to_decimal_type =
144
7.59k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
7.59k
                    to_precision = to_decimal_type->get_precision();
146
7.59k
                    ToDataType::check_type_precision(to_precision);
147
148
7.59k
                    to_scale = to_decimal_type->get_scale();
149
7.59k
                    ToDataType::check_type_scale(to_scale);
150
7.59k
                }
151
7.59k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
7.59k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
7.59k
                    to_precision = to_max_digits;
154
7.59k
                }
155
156
7.59k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
7.59k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
7.59k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
7.59k
                if (to_scale > from_scale) {
161
7.59k
                    multiply_may_overflow &=
162
7.59k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
7.59k
                }
164
7.59k
                return narrow_integral || multiply_may_overflow;
165
7.59k
            }
166
7.59k
            return false;
167
7.59k
        });
168
7.59k
    };
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.94k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
6.94k
        using Types = std::decay_t<decltype(types)>;
106
6.94k
        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.94k
        return call_on_index_and_data_type<
114
6.94k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
6.94k
            using Types2 = std::decay_t<decltype(types2)>;
116
6.94k
            using FromDataType = typename Types2::LeftType;
117
6.94k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
6.94k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
6.94k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
6.94k
                return false;
121
6.94k
            }
122
6.94k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
6.94k
                using FromFieldType = typename FromDataType::FieldType;
124
6.94k
                using ToFieldType = typename ToDataType::FieldType;
125
6.94k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
6.94k
                UInt32 from_scale = 0;
127
128
6.94k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
6.94k
                    const auto* from_decimal_type =
130
6.94k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
6.94k
                    from_precision =
132
6.94k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
6.94k
                    from_scale = from_decimal_type->get_scale();
134
6.94k
                }
135
136
6.94k
                UInt32 to_max_digits = 0;
137
6.94k
                UInt32 to_precision = 0;
138
6.94k
                UInt32 to_scale = 0;
139
140
6.94k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
6.94k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
6.94k
                    const auto* to_decimal_type =
144
6.94k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
6.94k
                    to_precision = to_decimal_type->get_precision();
146
6.94k
                    ToDataType::check_type_precision(to_precision);
147
148
6.94k
                    to_scale = to_decimal_type->get_scale();
149
6.94k
                    ToDataType::check_type_scale(to_scale);
150
6.94k
                }
151
6.94k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
6.94k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
6.94k
                    to_precision = to_max_digits;
154
6.94k
                }
155
156
6.94k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
6.94k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
6.94k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
6.94k
                if (to_scale > from_scale) {
161
6.94k
                    multiply_may_overflow &=
162
6.94k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
6.94k
                }
164
6.94k
                return narrow_integral || multiply_may_overflow;
165
6.94k
            }
166
6.94k
            return false;
167
6.94k
        });
168
6.94k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
104
3.73k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
3.73k
        using Types = std::decay_t<decltype(types)>;
106
3.73k
        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.73k
        return call_on_index_and_data_type<
114
3.73k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3.73k
            using Types2 = std::decay_t<decltype(types2)>;
116
3.73k
            using FromDataType = typename Types2::LeftType;
117
3.73k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
3.73k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
3.73k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
3.73k
                return false;
121
3.73k
            }
122
3.73k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
3.73k
                using FromFieldType = typename FromDataType::FieldType;
124
3.73k
                using ToFieldType = typename ToDataType::FieldType;
125
3.73k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
3.73k
                UInt32 from_scale = 0;
127
128
3.73k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
3.73k
                    const auto* from_decimal_type =
130
3.73k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
3.73k
                    from_precision =
132
3.73k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
3.73k
                    from_scale = from_decimal_type->get_scale();
134
3.73k
                }
135
136
3.73k
                UInt32 to_max_digits = 0;
137
3.73k
                UInt32 to_precision = 0;
138
3.73k
                UInt32 to_scale = 0;
139
140
3.73k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
3.73k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
3.73k
                    const auto* to_decimal_type =
144
3.73k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
3.73k
                    to_precision = to_decimal_type->get_precision();
146
3.73k
                    ToDataType::check_type_precision(to_precision);
147
148
3.73k
                    to_scale = to_decimal_type->get_scale();
149
3.73k
                    ToDataType::check_type_scale(to_scale);
150
3.73k
                }
151
3.73k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
3.73k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
3.73k
                    to_precision = to_max_digits;
154
3.73k
                }
155
156
3.73k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
3.73k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
3.73k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
3.73k
                if (to_scale > from_scale) {
161
3.73k
                    multiply_may_overflow &=
162
3.73k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
3.73k
                }
164
3.73k
                return narrow_integral || multiply_may_overflow;
165
3.73k
            }
166
3.73k
            return false;
167
3.73k
        });
168
3.73k
    };
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
623
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
623
        using Types = std::decay_t<decltype(types)>;
106
623
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
623
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
623
            return false;
112
623
        }
113
0
        return call_on_index_and_data_type<
114
623
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
623
            using Types2 = std::decay_t<decltype(types2)>;
116
623
            using FromDataType = typename Types2::LeftType;
117
623
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
623
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
623
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
623
                return false;
121
623
            }
122
623
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
623
                using FromFieldType = typename FromDataType::FieldType;
124
623
                using ToFieldType = typename ToDataType::FieldType;
125
623
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
623
                UInt32 from_scale = 0;
127
128
623
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
623
                    const auto* from_decimal_type =
130
623
                            check_and_get_data_type<FromDataType>(from_type.get());
131
623
                    from_precision =
132
623
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
623
                    from_scale = from_decimal_type->get_scale();
134
623
                }
135
136
623
                UInt32 to_max_digits = 0;
137
623
                UInt32 to_precision = 0;
138
623
                UInt32 to_scale = 0;
139
140
623
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
623
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
623
                    const auto* to_decimal_type =
144
623
                            check_and_get_data_type<ToDataType>(to_type.get());
145
623
                    to_precision = to_decimal_type->get_precision();
146
623
                    ToDataType::check_type_precision(to_precision);
147
148
623
                    to_scale = to_decimal_type->get_scale();
149
623
                    ToDataType::check_type_scale(to_scale);
150
623
                }
151
623
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
623
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
623
                    to_precision = to_max_digits;
154
623
                }
155
156
623
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
623
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
623
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
623
                if (to_scale > from_scale) {
161
623
                    multiply_may_overflow &=
162
623
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
623
                }
164
623
                return narrow_integral || multiply_may_overflow;
165
623
            }
166
623
            return false;
167
623
        });
168
623
    };
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
36.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
36.9k
        using Types = std::decay_t<decltype(types)>;
106
36.9k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
36.9k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
36.9k
            return false;
112
36.9k
        }
113
0
        return call_on_index_and_data_type<
114
36.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
36.9k
            using Types2 = std::decay_t<decltype(types2)>;
116
36.9k
            using FromDataType = typename Types2::LeftType;
117
36.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
36.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
36.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
36.9k
                return false;
121
36.9k
            }
122
36.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
36.9k
                using FromFieldType = typename FromDataType::FieldType;
124
36.9k
                using ToFieldType = typename ToDataType::FieldType;
125
36.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
36.9k
                UInt32 from_scale = 0;
127
128
36.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
36.9k
                    const auto* from_decimal_type =
130
36.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
36.9k
                    from_precision =
132
36.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
36.9k
                    from_scale = from_decimal_type->get_scale();
134
36.9k
                }
135
136
36.9k
                UInt32 to_max_digits = 0;
137
36.9k
                UInt32 to_precision = 0;
138
36.9k
                UInt32 to_scale = 0;
139
140
36.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
36.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
36.9k
                    const auto* to_decimal_type =
144
36.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
36.9k
                    to_precision = to_decimal_type->get_precision();
146
36.9k
                    ToDataType::check_type_precision(to_precision);
147
148
36.9k
                    to_scale = to_decimal_type->get_scale();
149
36.9k
                    ToDataType::check_type_scale(to_scale);
150
36.9k
                }
151
36.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
36.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
36.9k
                    to_precision = to_max_digits;
154
36.9k
                }
155
156
36.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
36.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
36.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
36.9k
                if (to_scale > from_scale) {
161
36.9k
                    multiply_may_overflow &=
162
36.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
36.9k
                }
164
36.9k
                return narrow_integral || multiply_may_overflow;
165
36.9k
            }
166
36.9k
            return false;
167
36.9k
        });
168
36.9k
    };
169
170
302k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
171
373k
}
172
173
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
174
401k
                                    const DataTypePtr& to_type) {
175
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
176
401k
    bool result_is_nullable = to_type->is_nullable();
177
178
401k
    if (result_is_nullable) {
179
373k
        return [from_type, to_type](FunctionContext* context, Block& block,
180
373k
                                    const ColumnNumbers& arguments, uint32_t result,
181
373k
                                    size_t input_rows_count,
182
373k
                                    const NullMap::value_type* null_map = nullptr) {
183
373k
            auto from_type_not_nullable = remove_nullable(from_type);
184
373k
            auto to_type_not_nullable = remove_nullable(to_type);
185
186
373k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
187
373k
                    context, from_type_not_nullable, to_type_not_nullable);
188
189
373k
            auto nested_result_index = block.columns();
190
373k
            block.insert(block.get_by_position(result).unnest_nullable());
191
373k
            auto nested_source_index = block.columns();
192
373k
            block.insert(block.get_by_position(arguments[0])
193
373k
                                 .unnest_nullable(replace_null_data_to_default));
194
195
373k
            const auto& arg_col = block.get_by_position(arguments[0]);
196
373k
            const NullMap::value_type* arg_null_map = nullptr;
197
373k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
198
328k
                arg_null_map = nullable->get_null_map_data().data();
199
328k
            }
200
373k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
201
373k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
202
373k
                    arg_null_map));
203
204
347k
            block.get_by_position(result).column =
205
347k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
206
347k
                                     arguments, input_rows_count);
207
208
347k
            block.erase(nested_source_index);
209
347k
            block.erase(nested_result_index);
210
347k
            return Status::OK();
211
373k
        };
212
373k
    } else {
213
28.4k
        return prepare_impl(context, from_type, to_type);
214
28.4k
    }
215
401k
}
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
413k
                         const DataTypePtr& origin_to_type) {
221
413k
    auto to_type = get_serialized_type(origin_to_type);
222
413k
    auto from_type = get_serialized_type(origin_from_type);
223
413k
    if (from_type->equals(*to_type)) {
224
75.1k
        return create_identity_wrapper(from_type);
225
75.1k
    }
226
227
    // variant needs to be judged first
228
338k
    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
326k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
233
14.1k
        return create_cast_from_variant_wrapper(static_cast<const DataTypeVariant&>(*from_type),
234
14.1k
                                                to_type);
235
14.1k
    }
236
237
312k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
238
9.40k
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
239
9.40k
                                              to_type,
240
18.4E
                                              context ? context->jsonb_string_as_string() : false);
241
9.40k
    }
242
243
303k
    switch (to_type->get_primitive_type()) {
244
951
    case PrimitiveType::TYPE_BOOLEAN:
245
951
        return create_boolean_wrapper(context, from_type);
246
4.85k
    case PrimitiveType::TYPE_TINYINT:
247
4.85k
        return create_int_wrapper<DataTypeInt8>(context, from_type);
248
5.28k
    case PrimitiveType::TYPE_SMALLINT:
249
5.28k
        return create_int_wrapper<DataTypeInt16>(context, from_type);
250
30.0k
    case PrimitiveType::TYPE_INT:
251
30.0k
        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.08k
    case PrimitiveType::TYPE_LARGEINT:
255
4.08k
        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
29.6k
    case PrimitiveType::TYPE_DOUBLE:
259
29.6k
        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.90k
    case PrimitiveType::TYPE_DATEV2:
265
6.90k
        return create_datelike_wrapper<DataTypeDateV2>(context, from_type);
266
4.11k
    case PrimitiveType::TYPE_DATETIMEV2:
267
4.11k
        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.90k
    case PrimitiveType::TYPE_DECIMAL32:
279
6.90k
        return create_decimal_wrapper<DataTypeDecimal32>(context, from_type);
280
16.5k
    case PrimitiveType::TYPE_DECIMAL64:
281
16.5k
        return create_decimal_wrapper<DataTypeDecimal64>(context, from_type);
282
15.7k
    case PrimitiveType::TYPE_DECIMAL128I:
283
15.7k
        return create_decimal_wrapper<DataTypeDecimal128>(context, from_type);
284
7.65k
    case PrimitiveType::TYPE_DECIMAL256:
285
7.65k
        return create_decimal_wrapper<DataTypeDecimal256>(context, from_type);
286
34
    case PrimitiveType::TYPE_CHAR:
287
6.99k
    case PrimitiveType::TYPE_VARCHAR:
288
34.5k
    case PrimitiveType::TYPE_STRING:
289
34.5k
        return create_string_wrapper(from_type);
290
14.8k
    case PrimitiveType::TYPE_ARRAY:
291
14.8k
        return create_array_wrapper(context, from_type,
292
14.8k
                                    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
303k
    }
311
312
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
313
303k
}
314
315
} // namespace CastWrapper
316
317
class PreparedFunctionCast : public PreparedFunctionImpl {
318
public:
319
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
320
386k
            : 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
386k
                        uint32_t result, size_t input_rows_count) const override {
327
386k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
328
386k
    }
329
330
386k
    bool use_default_implementation_for_nulls() const override { return false; }
331
386k
    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
294k
            : name(name_),
342
294k
              argument_types(std::move(argument_types_)),
343
294k
              return_type(std::move(return_type_)) {}
344
345
386k
    const DataTypes& get_argument_types() const override { return argument_types; }
346
386k
    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
386k
                                uint32_t /*result*/) const override {
351
386k
        return std::make_shared<PreparedFunctionCast>(
352
386k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
353
386k
                                                         get_return_type()),
354
386k
                name);
355
386k
    }
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
294k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
372
373
294k
    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
884k
        for (size_t i = 0; i < arguments.size(); ++i) {
387
589k
            data_types[i] = arguments[i].type;
388
589k
        }
389
390
294k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
391
294k
    }
392
393
294k
    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