Coverage Report

Created: 2026-03-13 19:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/function/cast/function_cast.cpp
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#include <utility>
19
20
#include "core/data_type/data_type_agg_state.h"
21
#include "core/data_type/data_type_decimal.h"
22
#include "core/data_type/data_type_number.h" // IWYU pragma: keep
23
#include "core/data_type/primitive_type.h"
24
#include "exprs/function/cast/cast_to_array.h"
25
#include "exprs/function/cast/cast_to_boolean.h"
26
#include "exprs/function/cast/cast_to_date.h"
27
#include "exprs/function/cast/cast_to_decimal.h"
28
#include "exprs/function/cast/cast_to_float.h"
29
#include "exprs/function/cast/cast_to_int.h"
30
#include "exprs/function/cast/cast_to_ip.h"
31
#include "exprs/function/cast/cast_to_jsonb.h"
32
#include "exprs/function/cast/cast_to_map.h"
33
#include "exprs/function/cast/cast_to_string.h"
34
#include "exprs/function/cast/cast_to_struct.h"
35
#include "exprs/function/cast/cast_to_timestamptz.h"
36
#include "exprs/function/cast/cast_to_variant.h"
37
#include "exprs/function/simple_function_factory.h"
38
39
namespace doris {
40
41
namespace CastWrapper {
42
43
WrapperType create_hll_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
44
0
                               const DataTypeHLL& to_type) {
45
    /// Conversion from String through parsing.
46
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
47
0
        return cast_from_string_to_generic;
48
0
    }
49
50
0
    return CastWrapper::create_unsupport_wrapper("Cast to HLL only support from String type");
51
0
}
52
53
WrapperType create_bitmap_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
54
0
                                  const DataTypeBitMap& to_type) {
55
    /// Conversion from String through parsing.
56
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
57
0
        return cast_from_string_to_generic;
58
0
    }
59
60
0
    return CastWrapper::create_unsupport_wrapper("Cast to BitMap only support from String type");
61
0
}
62
63
0
WrapperType create_varbinary_wrapper(const DataTypePtr& from_type_untyped) {
64
    /// Conversion from String through parsing.
65
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
66
0
        return cast_from_string_to_generic;
67
0
    }
68
69
0
    return CastWrapper::create_unsupport_wrapper("Cast to Varbinary only support from String type");
70
0
}
71
72
WrapperType prepare_unpack_dictionaries(FunctionContext* context, const DataTypePtr& from_type,
73
85.0k
                                        const DataTypePtr& to_type) {
74
85.0k
    const auto& from_nested = from_type;
75
85.0k
    const auto& to_nested = to_type;
76
77
85.0k
    if (from_type->is_null_literal()) {
78
0
        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
0
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
84
0
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
85
            /// TODO: remove this in the future.
86
0
            auto& res = block.get_by_position(result);
87
0
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
88
0
                                 ->convert_to_full_column_if_const();
89
0
            return Status::OK();
90
0
        };
91
0
    }
92
93
85.0k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
94
95
85.0k
    return wrapper;
96
85.0k
}
97
98
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
99
84.9k
                                       const DataTypePtr& to_type) {
100
84.9k
    if (from_type->equals(*to_type)) {
101
126
        return false;
102
126
    }
103
104
84.8k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
35.2k
        using Types = std::decay_t<decltype(types)>;
106
35.2k
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
48
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
48
            return false;
112
48
        }
113
0
        return call_on_index_and_data_type<
114
35.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
35.1k
            using Types2 = std::decay_t<decltype(types2)>;
116
35.1k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
10.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
10.2k
                return false;
121
10.2k
            }
122
12.8k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
12.8k
                using FromFieldType = typename FromDataType::FieldType;
124
12.8k
                using ToFieldType = typename ToDataType::FieldType;
125
12.8k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
12.8k
                UInt32 from_scale = 0;
127
128
12.8k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
5.45k
                    const auto* from_decimal_type =
130
5.45k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
5.45k
                    from_precision =
132
5.45k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
5.45k
                    from_scale = from_decimal_type->get_scale();
134
5.45k
                }
135
136
12.8k
                UInt32 to_max_digits = 0;
137
12.8k
                UInt32 to_precision = 0;
138
12.8k
                UInt32 to_scale = 0;
139
140
12.8k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
12.3k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
12.3k
                    const auto* to_decimal_type =
144
12.3k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
12.3k
                    to_precision = to_decimal_type->get_precision();
146
12.3k
                    ToDataType::check_type_precision(to_precision);
147
148
12.3k
                    to_scale = to_decimal_type->get_scale();
149
12.3k
                    ToDataType::check_type_scale(to_scale);
150
12.3k
                }
151
12.8k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
573
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
573
                    to_precision = to_max_digits;
154
573
                }
155
156
12.8k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
12.8k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
12.8k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
12.8k
                if (to_scale > from_scale) {
161
3.13k
                    multiply_may_overflow &=
162
3.13k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
3.13k
                }
164
12.8k
                return narrow_integral || multiply_may_overflow;
165
12.8k
            }
166
0
            return false;
167
35.1k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
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_6EEESE_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_7EEESE_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_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
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_INS_15DataTypeDecimalILSD_28EEESE_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_29EEESE_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_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
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_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
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
12
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
12
                return false;
121
12
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
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_13PrimitiveTypeE3EEEvEEEEbRKT_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
        });
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
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_5EEESE_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_6EEESE_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_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
27
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
27
            using Types2 = std::decay_t<decltype(types2)>;
116
27
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
27
            return false;
167
27
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
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_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_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_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
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_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_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
        });
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
857
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
857
            using Types2 = std::decay_t<decltype(types2)>;
116
857
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
857
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
857
                return false;
121
857
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
857
            return false;
167
857
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
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_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_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
        });
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
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_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_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_13PrimitiveTypeE4EEEvEEEEbRKT_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_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
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_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_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_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
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_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_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
        });
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
841
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
841
            using Types2 = std::decay_t<decltype(types2)>;
116
841
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
841
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
841
                return false;
121
841
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
841
            return false;
167
841
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
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_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_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_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_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
        });
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
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_13PrimitiveTypeE5EEEvEEEEbRKT_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_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_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
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
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
            return false;
167
17
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
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_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_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_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_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_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
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_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_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
        });
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
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_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
825
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
825
            using Types2 = std::decay_t<decltype(types2)>;
116
825
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
825
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
825
                return false;
121
825
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
825
            return false;
167
825
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
114
82
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
82
            using Types2 = std::decay_t<decltype(types2)>;
116
82
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
82
            return false;
167
82
        });
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
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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_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
        });
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
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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_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
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
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
            return false;
167
17
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_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_13PrimitiveTypeE6EEEvEEEEbRKT_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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_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
        });
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
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_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_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
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
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_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
809
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
809
            using Types2 = std::decay_t<decltype(types2)>;
116
809
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
809
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
809
                return false;
121
809
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
809
            return false;
167
809
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
114
96
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
96
            using Types2 = std::decay_t<decltype(types2)>;
116
96
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
96
            return false;
167
96
        });
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
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_INSC_ILSD_4EEESE_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_INSC_ILSD_5EEESE_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_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
114
78
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
78
            using Types2 = std::decay_t<decltype(types2)>;
116
78
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
78
            return false;
167
78
        });
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
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_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_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_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
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_35EEESE_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
        });
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
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_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
793
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
793
            using Types2 = std::decay_t<decltype(types2)>;
116
793
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
793
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
793
                return false;
121
793
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
793
            return false;
167
793
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
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
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_4EEESE_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_5EEESE_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_6EEESE_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_7EEESE_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
        });
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
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_INS_15DataTypeDecimalILSD_28EEESE_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_29EEESE_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_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
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_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
114
36
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
36
            using Types2 = std::decay_t<decltype(types2)>;
116
36
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
36
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
36
                using FromFieldType = typename FromDataType::FieldType;
124
36
                using ToFieldType = typename ToDataType::FieldType;
125
36
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
36
                UInt32 from_scale = 0;
127
128
36
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
36
                    const auto* from_decimal_type =
130
36
                            check_and_get_data_type<FromDataType>(from_type.get());
131
36
                    from_precision =
132
36
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
36
                    from_scale = from_decimal_type->get_scale();
134
36
                }
135
136
36
                UInt32 to_max_digits = 0;
137
36
                UInt32 to_precision = 0;
138
36
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
36
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
36
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
36
                    to_precision = to_max_digits;
154
36
                }
155
156
36
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
36
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
36
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
36
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
36
                return narrow_integral || multiply_may_overflow;
165
36
            }
166
0
            return false;
167
36
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
114
37
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
37
            using Types2 = std::decay_t<decltype(types2)>;
116
37
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
37
            return false;
167
37
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
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
80
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
80
            using Types2 = std::decay_t<decltype(types2)>;
116
80
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
80
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
80
                return false;
121
80
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
80
            return false;
167
80
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
114
76
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
76
            using Types2 = std::decay_t<decltype(types2)>;
116
76
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
76
            return false;
167
76
        });
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
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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_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_13PrimitiveTypeE9EEEvEEEEbRKT_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
        });
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
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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_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_13PrimitiveTypeE9EEEvEEEEbRKT_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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_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
        });
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
37
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
37
            using Types2 = std::decay_t<decltype(types2)>;
116
37
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
37
            return false;
167
37
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
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_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
80
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
80
            using Types2 = std::decay_t<decltype(types2)>;
116
80
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
80
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
80
                return false;
121
80
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
80
            return false;
167
80
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
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_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
114
34
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
34
            using Types2 = std::decay_t<decltype(types2)>;
116
34
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
34
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
34
                using FromFieldType = typename FromDataType::FieldType;
124
34
                using ToFieldType = typename ToDataType::FieldType;
125
34
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
34
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
34
                UInt32 to_max_digits = 0;
137
34
                UInt32 to_precision = 0;
138
34
                UInt32 to_scale = 0;
139
140
34
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
34
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
34
                    const auto* to_decimal_type =
144
34
                            check_and_get_data_type<ToDataType>(to_type.get());
145
34
                    to_precision = to_decimal_type->get_precision();
146
34
                    ToDataType::check_type_precision(to_precision);
147
148
34
                    to_scale = to_decimal_type->get_scale();
149
34
                    ToDataType::check_type_scale(to_scale);
150
34
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
34
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
34
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
34
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
34
                if (to_scale > from_scale) {
161
23
                    multiply_may_overflow &=
162
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
23
                }
164
34
                return narrow_integral || multiply_may_overflow;
165
34
            }
166
0
            return false;
167
34
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
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
39
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
39
                using FromFieldType = typename FromDataType::FieldType;
124
39
                using ToFieldType = typename ToDataType::FieldType;
125
39
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
39
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
39
                UInt32 to_max_digits = 0;
137
39
                UInt32 to_precision = 0;
138
39
                UInt32 to_scale = 0;
139
140
39
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
39
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
39
                    const auto* to_decimal_type =
144
39
                            check_and_get_data_type<ToDataType>(to_type.get());
145
39
                    to_precision = to_decimal_type->get_precision();
146
39
                    ToDataType::check_type_precision(to_precision);
147
148
39
                    to_scale = to_decimal_type->get_scale();
149
39
                    ToDataType::check_type_scale(to_scale);
150
39
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
39
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
39
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
39
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
39
                if (to_scale > from_scale) {
161
23
                    multiply_may_overflow &=
162
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
23
                }
164
39
                return narrow_integral || multiply_may_overflow;
165
39
            }
166
0
            return false;
167
39
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
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
28
                    multiply_may_overflow &=
162
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
28
                }
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_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_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
28
                    multiply_may_overflow &=
162
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
28
                }
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_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_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
28
                    multiply_may_overflow &=
162
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
28
                }
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_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_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
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
99
                using FromFieldType = typename FromDataType::FieldType;
124
99
                using ToFieldType = typename ToDataType::FieldType;
125
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
99
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
99
                UInt32 to_max_digits = 0;
137
99
                UInt32 to_precision = 0;
138
99
                UInt32 to_scale = 0;
139
140
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
99
                    const auto* to_decimal_type =
144
99
                            check_and_get_data_type<ToDataType>(to_type.get());
145
99
                    to_precision = to_decimal_type->get_precision();
146
99
                    ToDataType::check_type_precision(to_precision);
147
148
99
                    to_scale = to_decimal_type->get_scale();
149
99
                    ToDataType::check_type_scale(to_scale);
150
99
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
99
                if (to_scale > from_scale) {
161
66
                    multiply_may_overflow &=
162
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
66
                }
164
99
                return narrow_integral || multiply_may_overflow;
165
99
            }
166
0
            return false;
167
99
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
114
103
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
103
            using Types2 = std::decay_t<decltype(types2)>;
116
103
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
103
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
103
                using FromFieldType = typename FromDataType::FieldType;
124
103
                using ToFieldType = typename ToDataType::FieldType;
125
103
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
103
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
103
                UInt32 to_max_digits = 0;
137
103
                UInt32 to_precision = 0;
138
103
                UInt32 to_scale = 0;
139
140
103
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
103
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
103
                    const auto* to_decimal_type =
144
103
                            check_and_get_data_type<ToDataType>(to_type.get());
145
103
                    to_precision = to_decimal_type->get_precision();
146
103
                    ToDataType::check_type_precision(to_precision);
147
148
103
                    to_scale = to_decimal_type->get_scale();
149
103
                    ToDataType::check_type_scale(to_scale);
150
103
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
103
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
103
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
103
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
103
                if (to_scale > from_scale) {
161
66
                    multiply_may_overflow &=
162
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
66
                }
164
103
                return narrow_integral || multiply_may_overflow;
165
103
            }
166
0
            return false;
167
103
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
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
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
128
                    const auto* from_decimal_type =
130
128
                            check_and_get_data_type<FromDataType>(from_type.get());
131
128
                    from_precision =
132
128
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
128
                    from_scale = from_decimal_type->get_scale();
134
128
                }
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
62
                    multiply_may_overflow &=
162
62
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
62
                }
164
128
                return narrow_integral || multiply_may_overflow;
165
128
            }
166
0
            return false;
167
128
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
114
285
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
285
            using Types2 = std::decay_t<decltype(types2)>;
116
285
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
285
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
285
                using FromFieldType = typename FromDataType::FieldType;
124
285
                using ToFieldType = typename ToDataType::FieldType;
125
285
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
285
                UInt32 from_scale = 0;
127
128
285
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
285
                    const auto* from_decimal_type =
130
285
                            check_and_get_data_type<FromDataType>(from_type.get());
131
285
                    from_precision =
132
285
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
285
                    from_scale = from_decimal_type->get_scale();
134
285
                }
135
136
285
                UInt32 to_max_digits = 0;
137
285
                UInt32 to_precision = 0;
138
285
                UInt32 to_scale = 0;
139
140
285
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
285
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
285
                    const auto* to_decimal_type =
144
285
                            check_and_get_data_type<ToDataType>(to_type.get());
145
285
                    to_precision = to_decimal_type->get_precision();
146
285
                    ToDataType::check_type_precision(to_precision);
147
148
285
                    to_scale = to_decimal_type->get_scale();
149
285
                    ToDataType::check_type_scale(to_scale);
150
285
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
285
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
285
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
285
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
285
                if (to_scale > from_scale) {
161
78
                    multiply_may_overflow &=
162
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
78
                }
164
285
                return narrow_integral || multiply_may_overflow;
165
285
            }
166
0
            return false;
167
285
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
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
161
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
161
                using FromFieldType = typename FromDataType::FieldType;
124
161
                using ToFieldType = typename ToDataType::FieldType;
125
161
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
161
                UInt32 from_scale = 0;
127
128
161
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
161
                    const auto* from_decimal_type =
130
161
                            check_and_get_data_type<FromDataType>(from_type.get());
131
161
                    from_precision =
132
161
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
161
                    from_scale = from_decimal_type->get_scale();
134
161
                }
135
136
161
                UInt32 to_max_digits = 0;
137
161
                UInt32 to_precision = 0;
138
161
                UInt32 to_scale = 0;
139
140
161
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
161
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
161
                    const auto* to_decimal_type =
144
161
                            check_and_get_data_type<ToDataType>(to_type.get());
145
161
                    to_precision = to_decimal_type->get_precision();
146
161
                    ToDataType::check_type_precision(to_precision);
147
148
161
                    to_scale = to_decimal_type->get_scale();
149
161
                    ToDataType::check_type_scale(to_scale);
150
161
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
161
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
161
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
161
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
161
                if (to_scale > from_scale) {
161
0
                    multiply_may_overflow &=
162
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
0
                }
164
161
                return narrow_integral || multiply_may_overflow;
165
161
            }
166
0
            return false;
167
161
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
114
296
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
296
            using Types2 = std::decay_t<decltype(types2)>;
116
296
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
296
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
296
                using FromFieldType = typename FromDataType::FieldType;
124
296
                using ToFieldType = typename ToDataType::FieldType;
125
296
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
296
                UInt32 from_scale = 0;
127
128
296
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
296
                    const auto* from_decimal_type =
130
296
                            check_and_get_data_type<FromDataType>(from_type.get());
131
296
                    from_precision =
132
296
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
296
                    from_scale = from_decimal_type->get_scale();
134
296
                }
135
136
296
                UInt32 to_max_digits = 0;
137
296
                UInt32 to_precision = 0;
138
296
                UInt32 to_scale = 0;
139
140
296
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
296
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
296
                    const auto* to_decimal_type =
144
296
                            check_and_get_data_type<ToDataType>(to_type.get());
145
296
                    to_precision = to_decimal_type->get_precision();
146
296
                    ToDataType::check_type_precision(to_precision);
147
148
296
                    to_scale = to_decimal_type->get_scale();
149
296
                    ToDataType::check_type_scale(to_scale);
150
296
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
296
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
296
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
296
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
296
                if (to_scale > from_scale) {
161
78
                    multiply_may_overflow &=
162
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
78
                }
164
296
                return narrow_integral || multiply_may_overflow;
165
296
            }
166
0
            return false;
167
296
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Line
Count
Source
114
296
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
296
            using Types2 = std::decay_t<decltype(types2)>;
116
296
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
296
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
296
                using FromFieldType = typename FromDataType::FieldType;
124
296
                using ToFieldType = typename ToDataType::FieldType;
125
296
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
296
                UInt32 from_scale = 0;
127
128
296
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
296
                    const auto* from_decimal_type =
130
296
                            check_and_get_data_type<FromDataType>(from_type.get());
131
296
                    from_precision =
132
296
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
296
                    from_scale = from_decimal_type->get_scale();
134
296
                }
135
136
296
                UInt32 to_max_digits = 0;
137
296
                UInt32 to_precision = 0;
138
296
                UInt32 to_scale = 0;
139
140
296
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
296
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
296
                    const auto* to_decimal_type =
144
296
                            check_and_get_data_type<ToDataType>(to_type.get());
145
296
                    to_precision = to_decimal_type->get_precision();
146
296
                    ToDataType::check_type_precision(to_precision);
147
148
296
                    to_scale = to_decimal_type->get_scale();
149
296
                    ToDataType::check_type_scale(to_scale);
150
296
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
296
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
296
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
296
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
296
                if (to_scale > from_scale) {
161
78
                    multiply_may_overflow &=
162
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
78
                }
164
296
                return narrow_integral || multiply_may_overflow;
165
296
            }
166
0
            return false;
167
296
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
114
1.63k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.63k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.63k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
1.63k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1.63k
                return false;
121
1.63k
            }
122
1.63k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1.63k
                using FromFieldType = typename FromDataType::FieldType;
124
1.63k
                using ToFieldType = typename ToDataType::FieldType;
125
1.63k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1.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
1.63k
                UInt32 to_max_digits = 0;
137
1.63k
                UInt32 to_precision = 0;
138
1.63k
                UInt32 to_scale = 0;
139
140
1.63k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1.63k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1.63k
                    const auto* to_decimal_type =
144
1.63k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1.63k
                    to_precision = to_decimal_type->get_precision();
146
1.63k
                    ToDataType::check_type_precision(to_precision);
147
148
1.63k
                    to_scale = to_decimal_type->get_scale();
149
1.63k
                    ToDataType::check_type_scale(to_scale);
150
1.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
1.63k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1.63k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1.63k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1.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
1.63k
                return narrow_integral || multiply_may_overflow;
165
1.63k
            }
166
0
            return false;
167
1.63k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
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_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_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
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
29
                using FromFieldType = typename FromDataType::FieldType;
124
29
                using ToFieldType = typename ToDataType::FieldType;
125
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
29
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
29
                UInt32 to_max_digits = 0;
137
29
                UInt32 to_precision = 0;
138
29
                UInt32 to_scale = 0;
139
140
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
29
                    const auto* to_decimal_type =
144
29
                            check_and_get_data_type<ToDataType>(to_type.get());
145
29
                    to_precision = to_decimal_type->get_precision();
146
29
                    ToDataType::check_type_precision(to_precision);
147
148
29
                    to_scale = to_decimal_type->get_scale();
149
29
                    ToDataType::check_type_scale(to_scale);
150
29
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
29
                if (to_scale > from_scale) {
161
18
                    multiply_may_overflow &=
162
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
18
                }
164
29
                return narrow_integral || multiply_may_overflow;
165
29
            }
166
0
            return false;
167
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
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
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
29
                using FromFieldType = typename FromDataType::FieldType;
124
29
                using ToFieldType = typename ToDataType::FieldType;
125
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
29
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
29
                UInt32 to_max_digits = 0;
137
29
                UInt32 to_precision = 0;
138
29
                UInt32 to_scale = 0;
139
140
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
29
                    const auto* to_decimal_type =
144
29
                            check_and_get_data_type<ToDataType>(to_type.get());
145
29
                    to_precision = to_decimal_type->get_precision();
146
29
                    ToDataType::check_type_precision(to_precision);
147
148
29
                    to_scale = to_decimal_type->get_scale();
149
29
                    ToDataType::check_type_scale(to_scale);
150
29
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
29
                if (to_scale > from_scale) {
161
18
                    multiply_may_overflow &=
162
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
18
                }
164
29
                return narrow_integral || multiply_may_overflow;
165
29
            }
166
0
            return false;
167
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
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
44
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
44
                using FromFieldType = typename FromDataType::FieldType;
124
44
                using ToFieldType = typename ToDataType::FieldType;
125
44
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
44
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
44
                UInt32 to_max_digits = 0;
137
44
                UInt32 to_precision = 0;
138
44
                UInt32 to_scale = 0;
139
140
44
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
44
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
44
                    const auto* to_decimal_type =
144
44
                            check_and_get_data_type<ToDataType>(to_type.get());
145
44
                    to_precision = to_decimal_type->get_precision();
146
44
                    ToDataType::check_type_precision(to_precision);
147
148
44
                    to_scale = to_decimal_type->get_scale();
149
44
                    ToDataType::check_type_scale(to_scale);
150
44
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
44
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
44
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
44
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
44
                if (to_scale > from_scale) {
161
28
                    multiply_may_overflow &=
162
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
28
                }
164
44
                return narrow_integral || multiply_may_overflow;
165
44
            }
166
0
            return false;
167
44
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
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
28
                    multiply_may_overflow &=
162
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
28
                }
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_7EEESE_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
28
                    multiply_may_overflow &=
162
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
28
                }
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_8EEESE_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
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
99
                using FromFieldType = typename FromDataType::FieldType;
124
99
                using ToFieldType = typename ToDataType::FieldType;
125
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
99
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
99
                UInt32 to_max_digits = 0;
137
99
                UInt32 to_precision = 0;
138
99
                UInt32 to_scale = 0;
139
140
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
99
                    const auto* to_decimal_type =
144
99
                            check_and_get_data_type<ToDataType>(to_type.get());
145
99
                    to_precision = to_decimal_type->get_precision();
146
99
                    ToDataType::check_type_precision(to_precision);
147
148
99
                    to_scale = to_decimal_type->get_scale();
149
99
                    ToDataType::check_type_scale(to_scale);
150
99
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
99
                if (to_scale > from_scale) {
161
58
                    multiply_may_overflow &=
162
58
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
58
                }
164
99
                return narrow_integral || multiply_may_overflow;
165
99
            }
166
0
            return false;
167
99
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
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
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
99
                using FromFieldType = typename FromDataType::FieldType;
124
99
                using ToFieldType = typename ToDataType::FieldType;
125
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
99
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
99
                UInt32 to_max_digits = 0;
137
99
                UInt32 to_precision = 0;
138
99
                UInt32 to_scale = 0;
139
140
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
99
                    const auto* to_decimal_type =
144
99
                            check_and_get_data_type<ToDataType>(to_type.get());
145
99
                    to_precision = to_decimal_type->get_precision();
146
99
                    ToDataType::check_type_precision(to_precision);
147
148
99
                    to_scale = to_decimal_type->get_scale();
149
99
                    ToDataType::check_type_scale(to_scale);
150
99
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
99
                if (to_scale > from_scale) {
161
66
                    multiply_may_overflow &=
162
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
66
                }
164
99
                return narrow_integral || multiply_may_overflow;
165
99
            }
166
0
            return false;
167
99
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
114
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
168
            using Types2 = std::decay_t<decltype(types2)>;
116
168
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
168
                using FromFieldType = typename FromDataType::FieldType;
124
168
                using ToFieldType = typename ToDataType::FieldType;
125
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
168
                UInt32 from_scale = 0;
127
128
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
168
                    const auto* from_decimal_type =
130
168
                            check_and_get_data_type<FromDataType>(from_type.get());
131
168
                    from_precision =
132
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
168
                    from_scale = from_decimal_type->get_scale();
134
168
                }
135
136
168
                UInt32 to_max_digits = 0;
137
168
                UInt32 to_precision = 0;
138
168
                UInt32 to_scale = 0;
139
140
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
168
                    const auto* to_decimal_type =
144
168
                            check_and_get_data_type<ToDataType>(to_type.get());
145
168
                    to_precision = to_decimal_type->get_precision();
146
168
                    ToDataType::check_type_precision(to_precision);
147
148
168
                    to_scale = to_decimal_type->get_scale();
149
168
                    ToDataType::check_type_scale(to_scale);
150
168
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
168
                if (to_scale > from_scale) {
161
105
                    multiply_may_overflow &=
162
105
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
105
                }
164
168
                return narrow_integral || multiply_may_overflow;
165
168
            }
166
0
            return false;
167
168
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
114
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
272
            using Types2 = std::decay_t<decltype(types2)>;
116
272
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
272
                using FromFieldType = typename FromDataType::FieldType;
124
272
                using ToFieldType = typename ToDataType::FieldType;
125
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
272
                UInt32 from_scale = 0;
127
128
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
272
                    const auto* from_decimal_type =
130
272
                            check_and_get_data_type<FromDataType>(from_type.get());
131
272
                    from_precision =
132
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
272
                    from_scale = from_decimal_type->get_scale();
134
272
                }
135
136
272
                UInt32 to_max_digits = 0;
137
272
                UInt32 to_precision = 0;
138
272
                UInt32 to_scale = 0;
139
140
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
272
                    const auto* to_decimal_type =
144
272
                            check_and_get_data_type<ToDataType>(to_type.get());
145
272
                    to_precision = to_decimal_type->get_precision();
146
272
                    ToDataType::check_type_precision(to_precision);
147
148
272
                    to_scale = to_decimal_type->get_scale();
149
272
                    ToDataType::check_type_scale(to_scale);
150
272
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
272
                if (to_scale > from_scale) {
161
152
                    multiply_may_overflow &=
162
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
152
                }
164
272
                return narrow_integral || multiply_may_overflow;
165
272
            }
166
0
            return false;
167
272
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
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
180
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
180
                    const auto* from_decimal_type =
130
180
                            check_and_get_data_type<FromDataType>(from_type.get());
131
180
                    from_precision =
132
180
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
180
                    from_scale = from_decimal_type->get_scale();
134
180
                }
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
50
                    multiply_may_overflow &=
162
50
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
50
                }
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_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
114
381
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
381
            using Types2 = std::decay_t<decltype(types2)>;
116
381
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
381
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
381
                using FromFieldType = typename FromDataType::FieldType;
124
381
                using ToFieldType = typename ToDataType::FieldType;
125
381
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
381
                UInt32 from_scale = 0;
127
128
381
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
381
                    const auto* from_decimal_type =
130
381
                            check_and_get_data_type<FromDataType>(from_type.get());
131
381
                    from_precision =
132
381
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
381
                    from_scale = from_decimal_type->get_scale();
134
381
                }
135
136
381
                UInt32 to_max_digits = 0;
137
381
                UInt32 to_precision = 0;
138
381
                UInt32 to_scale = 0;
139
140
381
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
381
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
381
                    const auto* to_decimal_type =
144
381
                            check_and_get_data_type<ToDataType>(to_type.get());
145
381
                    to_precision = to_decimal_type->get_precision();
146
381
                    ToDataType::check_type_precision(to_precision);
147
148
381
                    to_scale = to_decimal_type->get_scale();
149
381
                    ToDataType::check_type_scale(to_scale);
150
381
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
381
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
381
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
381
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
381
                if (to_scale > from_scale) {
161
136
                    multiply_may_overflow &=
162
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
136
                }
164
381
                return narrow_integral || multiply_may_overflow;
165
381
            }
166
0
            return false;
167
381
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Line
Count
Source
114
392
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
392
            using Types2 = std::decay_t<decltype(types2)>;
116
392
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
392
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
392
                using FromFieldType = typename FromDataType::FieldType;
124
392
                using ToFieldType = typename ToDataType::FieldType;
125
392
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
392
                UInt32 from_scale = 0;
127
128
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
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
392
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
392
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
392
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
392
                if (to_scale > from_scale) {
161
136
                    multiply_may_overflow &=
162
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
136
                }
164
392
                return narrow_integral || multiply_may_overflow;
165
392
            }
166
0
            return false;
167
392
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
114
1.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.41k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.41k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
1.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1.41k
                return false;
121
1.41k
            }
122
1.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1.41k
                using FromFieldType = typename FromDataType::FieldType;
124
1.41k
                using ToFieldType = typename ToDataType::FieldType;
125
1.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1.41k
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_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.41k
                UInt32 to_max_digits = 0;
137
1.41k
                UInt32 to_precision = 0;
138
1.41k
                UInt32 to_scale = 0;
139
140
1.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1.41k
                    const auto* to_decimal_type =
144
1.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1.41k
                    to_precision = to_decimal_type->get_precision();
146
1.41k
                    ToDataType::check_type_precision(to_precision);
147
148
1.41k
                    to_scale = to_decimal_type->get_scale();
149
1.41k
                    ToDataType::check_type_scale(to_scale);
150
1.41k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || 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.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1.41k
                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.41k
                return narrow_integral || multiply_may_overflow;
165
1.41k
            }
166
0
            return false;
167
1.41k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
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
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
4
                using FromFieldType = typename FromDataType::FieldType;
124
4
                using ToFieldType = typename ToDataType::FieldType;
125
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
4
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_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
                UInt32 to_max_digits = 0;
137
4
                UInt32 to_precision = 0;
138
4
                UInt32 to_scale = 0;
139
140
4
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
4
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
4
                    const auto* to_decimal_type =
144
4
                            check_and_get_data_type<ToDataType>(to_type.get());
145
4
                    to_precision = to_decimal_type->get_precision();
146
4
                    ToDataType::check_type_precision(to_precision);
147
148
4
                    to_scale = to_decimal_type->get_scale();
149
4
                    ToDataType::check_type_scale(to_scale);
150
4
                }
151
                if constexpr (IsIntegralV<ToFieldType> || 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
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
4
                if (to_scale > from_scale) {
161
4
                    multiply_may_overflow &=
162
4
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
4
                }
164
4
                return narrow_integral || multiply_may_overflow;
165
4
            }
166
0
            return false;
167
4
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
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_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_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
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
29
                using FromFieldType = typename FromDataType::FieldType;
124
29
                using ToFieldType = typename ToDataType::FieldType;
125
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
29
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
29
                UInt32 to_max_digits = 0;
137
29
                UInt32 to_precision = 0;
138
29
                UInt32 to_scale = 0;
139
140
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
29
                    const auto* to_decimal_type =
144
29
                            check_and_get_data_type<ToDataType>(to_type.get());
145
29
                    to_precision = to_decimal_type->get_precision();
146
29
                    ToDataType::check_type_precision(to_precision);
147
148
29
                    to_scale = to_decimal_type->get_scale();
149
29
                    ToDataType::check_type_scale(to_scale);
150
29
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
29
                if (to_scale > from_scale) {
161
18
                    multiply_may_overflow &=
162
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
18
                }
164
29
                return narrow_integral || multiply_may_overflow;
165
29
            }
166
0
            return false;
167
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
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
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
29
                using FromFieldType = typename FromDataType::FieldType;
124
29
                using ToFieldType = typename ToDataType::FieldType;
125
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
29
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
29
                UInt32 to_max_digits = 0;
137
29
                UInt32 to_precision = 0;
138
29
                UInt32 to_scale = 0;
139
140
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
29
                    const auto* to_decimal_type =
144
29
                            check_and_get_data_type<ToDataType>(to_type.get());
145
29
                    to_precision = to_decimal_type->get_precision();
146
29
                    ToDataType::check_type_precision(to_precision);
147
148
29
                    to_scale = to_decimal_type->get_scale();
149
29
                    ToDataType::check_type_scale(to_scale);
150
29
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
29
                if (to_scale > from_scale) {
161
18
                    multiply_may_overflow &=
162
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
18
                }
164
29
                return narrow_integral || multiply_may_overflow;
165
29
            }
166
0
            return false;
167
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
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
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
29
                using FromFieldType = typename FromDataType::FieldType;
124
29
                using ToFieldType = typename ToDataType::FieldType;
125
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
29
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
29
                UInt32 to_max_digits = 0;
137
29
                UInt32 to_precision = 0;
138
29
                UInt32 to_scale = 0;
139
140
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
29
                    const auto* to_decimal_type =
144
29
                            check_and_get_data_type<ToDataType>(to_type.get());
145
29
                    to_precision = to_decimal_type->get_precision();
146
29
                    ToDataType::check_type_precision(to_precision);
147
148
29
                    to_scale = to_decimal_type->get_scale();
149
29
                    ToDataType::check_type_scale(to_scale);
150
29
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
29
                if (to_scale > from_scale) {
161
18
                    multiply_may_overflow &=
162
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
18
                }
164
29
                return narrow_integral || multiply_may_overflow;
165
29
            }
166
0
            return false;
167
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
114
34
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
34
            using Types2 = std::decay_t<decltype(types2)>;
116
34
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
34
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
34
                using FromFieldType = typename FromDataType::FieldType;
124
34
                using ToFieldType = typename ToDataType::FieldType;
125
34
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
34
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
34
                UInt32 to_max_digits = 0;
137
34
                UInt32 to_precision = 0;
138
34
                UInt32 to_scale = 0;
139
140
34
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
34
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
34
                    const auto* to_decimal_type =
144
34
                            check_and_get_data_type<ToDataType>(to_type.get());
145
34
                    to_precision = to_decimal_type->get_precision();
146
34
                    ToDataType::check_type_precision(to_precision);
147
148
34
                    to_scale = to_decimal_type->get_scale();
149
34
                    ToDataType::check_type_scale(to_scale);
150
34
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
34
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
34
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
34
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
34
                if (to_scale > from_scale) {
161
23
                    multiply_may_overflow &=
162
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
23
                }
164
34
                return narrow_integral || multiply_may_overflow;
165
34
            }
166
0
            return false;
167
34
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
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
28
                    multiply_may_overflow &=
162
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
28
                }
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_13PrimitiveTypeE30EEEvEEEEbRKT_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
66
                    multiply_may_overflow &=
162
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
66
                }
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_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
114
91
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
91
            using Types2 = std::decay_t<decltype(types2)>;
116
91
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
91
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
91
                using FromFieldType = typename FromDataType::FieldType;
124
91
                using ToFieldType = typename ToDataType::FieldType;
125
91
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
91
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
91
                UInt32 to_max_digits = 0;
137
91
                UInt32 to_precision = 0;
138
91
                UInt32 to_scale = 0;
139
140
91
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
91
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
91
                    const auto* to_decimal_type =
144
91
                            check_and_get_data_type<ToDataType>(to_type.get());
145
91
                    to_precision = to_decimal_type->get_precision();
146
91
                    ToDataType::check_type_precision(to_precision);
147
148
91
                    to_scale = to_decimal_type->get_scale();
149
91
                    ToDataType::check_type_scale(to_scale);
150
91
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
91
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
91
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
91
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
91
                if (to_scale > from_scale) {
161
58
                    multiply_may_overflow &=
162
58
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
58
                }
164
91
                return narrow_integral || multiply_may_overflow;
165
91
            }
166
0
            return false;
167
91
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
114
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
168
            using Types2 = std::decay_t<decltype(types2)>;
116
168
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
168
                using FromFieldType = typename FromDataType::FieldType;
124
168
                using ToFieldType = typename ToDataType::FieldType;
125
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
168
                UInt32 from_scale = 0;
127
128
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
168
                    const auto* from_decimal_type =
130
168
                            check_and_get_data_type<FromDataType>(from_type.get());
131
168
                    from_precision =
132
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
168
                    from_scale = from_decimal_type->get_scale();
134
168
                }
135
136
168
                UInt32 to_max_digits = 0;
137
168
                UInt32 to_precision = 0;
138
168
                UInt32 to_scale = 0;
139
140
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
168
                    const auto* to_decimal_type =
144
168
                            check_and_get_data_type<ToDataType>(to_type.get());
145
168
                    to_precision = to_decimal_type->get_precision();
146
168
                    ToDataType::check_type_precision(to_precision);
147
148
168
                    to_scale = to_decimal_type->get_scale();
149
168
                    ToDataType::check_type_scale(to_scale);
150
168
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
168
                if (to_scale > from_scale) {
161
106
                    multiply_may_overflow &=
162
106
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
106
                }
164
168
                return narrow_integral || multiply_may_overflow;
165
168
            }
166
0
            return false;
167
168
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
114
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
264
            using Types2 = std::decay_t<decltype(types2)>;
116
264
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
264
                using FromFieldType = typename FromDataType::FieldType;
124
264
                using ToFieldType = typename ToDataType::FieldType;
125
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
264
                UInt32 from_scale = 0;
127
128
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
264
                    const auto* from_decimal_type =
130
264
                            check_and_get_data_type<FromDataType>(from_type.get());
131
264
                    from_precision =
132
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
264
                    from_scale = from_decimal_type->get_scale();
134
264
                }
135
136
264
                UInt32 to_max_digits = 0;
137
264
                UInt32 to_precision = 0;
138
264
                UInt32 to_scale = 0;
139
140
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
264
                    const auto* to_decimal_type =
144
264
                            check_and_get_data_type<ToDataType>(to_type.get());
145
264
                    to_precision = to_decimal_type->get_precision();
146
264
                    ToDataType::check_type_precision(to_precision);
147
148
264
                    to_scale = to_decimal_type->get_scale();
149
264
                    ToDataType::check_type_scale(to_scale);
150
264
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
264
                if (to_scale > from_scale) {
161
159
                    multiply_may_overflow &=
162
159
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
159
                }
164
264
                return narrow_integral || multiply_may_overflow;
165
264
            }
166
0
            return false;
167
264
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
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
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
135
                using FromFieldType = typename FromDataType::FieldType;
124
135
                using ToFieldType = typename ToDataType::FieldType;
125
135
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
135
                UInt32 from_scale = 0;
127
128
135
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
135
                    const auto* from_decimal_type =
130
135
                            check_and_get_data_type<FromDataType>(from_type.get());
131
135
                    from_precision =
132
135
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
135
                    from_scale = from_decimal_type->get_scale();
134
135
                }
135
136
135
                UInt32 to_max_digits = 0;
137
135
                UInt32 to_precision = 0;
138
135
                UInt32 to_scale = 0;
139
140
135
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
135
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
135
                    const auto* to_decimal_type =
144
135
                            check_and_get_data_type<ToDataType>(to_type.get());
145
135
                    to_precision = to_decimal_type->get_precision();
146
135
                    ToDataType::check_type_precision(to_precision);
147
148
135
                    to_scale = to_decimal_type->get_scale();
149
135
                    ToDataType::check_type_scale(to_scale);
150
135
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
135
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
135
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
135
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
135
                if (to_scale > from_scale) {
161
68
                    multiply_may_overflow &=
162
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
68
                }
164
135
                return narrow_integral || multiply_may_overflow;
165
135
            }
166
0
            return false;
167
135
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
114
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
272
            using Types2 = std::decay_t<decltype(types2)>;
116
272
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
272
                using FromFieldType = typename FromDataType::FieldType;
124
272
                using ToFieldType = typename ToDataType::FieldType;
125
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
272
                UInt32 from_scale = 0;
127
128
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
272
                    const auto* from_decimal_type =
130
272
                            check_and_get_data_type<FromDataType>(from_type.get());
131
272
                    from_precision =
132
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
272
                    from_scale = from_decimal_type->get_scale();
134
272
                }
135
136
272
                UInt32 to_max_digits = 0;
137
272
                UInt32 to_precision = 0;
138
272
                UInt32 to_scale = 0;
139
140
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
272
                    const auto* to_decimal_type =
144
272
                            check_and_get_data_type<ToDataType>(to_type.get());
145
272
                    to_precision = to_decimal_type->get_precision();
146
272
                    ToDataType::check_type_precision(to_precision);
147
148
272
                    to_scale = to_decimal_type->get_scale();
149
272
                    ToDataType::check_type_scale(to_scale);
150
272
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
272
                if (to_scale > from_scale) {
161
152
                    multiply_may_overflow &=
162
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
152
                }
164
272
                return narrow_integral || multiply_may_overflow;
165
272
            }
166
0
            return false;
167
272
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Line
Count
Source
114
381
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
381
            using Types2 = std::decay_t<decltype(types2)>;
116
381
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
381
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
381
                using FromFieldType = typename FromDataType::FieldType;
124
381
                using ToFieldType = typename ToDataType::FieldType;
125
381
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
381
                UInt32 from_scale = 0;
127
128
381
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
381
                    const auto* from_decimal_type =
130
381
                            check_and_get_data_type<FromDataType>(from_type.get());
131
381
                    from_precision =
132
381
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
381
                    from_scale = from_decimal_type->get_scale();
134
381
                }
135
136
381
                UInt32 to_max_digits = 0;
137
381
                UInt32 to_precision = 0;
138
381
                UInt32 to_scale = 0;
139
140
381
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
381
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
381
                    const auto* to_decimal_type =
144
381
                            check_and_get_data_type<ToDataType>(to_type.get());
145
381
                    to_precision = to_decimal_type->get_precision();
146
381
                    ToDataType::check_type_precision(to_precision);
147
148
381
                    to_scale = to_decimal_type->get_scale();
149
381
                    ToDataType::check_type_scale(to_scale);
150
381
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
381
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
381
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
381
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
381
                if (to_scale > from_scale) {
161
136
                    multiply_may_overflow &=
162
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
136
                }
164
381
                return narrow_integral || multiply_may_overflow;
165
381
            }
166
0
            return false;
167
381
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
114
1.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.41k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.41k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
1.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1.41k
                return false;
121
1.41k
            }
122
1.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1.41k
                using FromFieldType = typename FromDataType::FieldType;
124
1.41k
                using ToFieldType = typename ToDataType::FieldType;
125
1.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1.41k
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_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.41k
                UInt32 to_max_digits = 0;
137
1.41k
                UInt32 to_precision = 0;
138
1.41k
                UInt32 to_scale = 0;
139
140
1.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1.41k
                    const auto* to_decimal_type =
144
1.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1.41k
                    to_precision = to_decimal_type->get_precision();
146
1.41k
                    ToDataType::check_type_precision(to_precision);
147
148
1.41k
                    to_scale = to_decimal_type->get_scale();
149
1.41k
                    ToDataType::check_type_scale(to_scale);
150
1.41k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || 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.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1.41k
                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.41k
                return narrow_integral || multiply_may_overflow;
165
1.41k
            }
166
0
            return false;
167
1.41k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
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
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
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
29
                using FromFieldType = typename FromDataType::FieldType;
124
29
                using ToFieldType = typename ToDataType::FieldType;
125
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
29
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
29
                UInt32 to_max_digits = 0;
137
29
                UInt32 to_precision = 0;
138
29
                UInt32 to_scale = 0;
139
140
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
29
                    const auto* to_decimal_type =
144
29
                            check_and_get_data_type<ToDataType>(to_type.get());
145
29
                    to_precision = to_decimal_type->get_precision();
146
29
                    ToDataType::check_type_precision(to_precision);
147
148
29
                    to_scale = to_decimal_type->get_scale();
149
29
                    ToDataType::check_type_scale(to_scale);
150
29
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
29
                if (to_scale > from_scale) {
161
18
                    multiply_may_overflow &=
162
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
18
                }
164
29
                return narrow_integral || multiply_may_overflow;
165
29
            }
166
0
            return false;
167
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
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
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
29
                using FromFieldType = typename FromDataType::FieldType;
124
29
                using ToFieldType = typename ToDataType::FieldType;
125
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
29
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
29
                UInt32 to_max_digits = 0;
137
29
                UInt32 to_precision = 0;
138
29
                UInt32 to_scale = 0;
139
140
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
29
                    const auto* to_decimal_type =
144
29
                            check_and_get_data_type<ToDataType>(to_type.get());
145
29
                    to_precision = to_decimal_type->get_precision();
146
29
                    ToDataType::check_type_precision(to_precision);
147
148
29
                    to_scale = to_decimal_type->get_scale();
149
29
                    ToDataType::check_type_scale(to_scale);
150
29
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
29
                if (to_scale > from_scale) {
161
18
                    multiply_may_overflow &=
162
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
18
                }
164
29
                return narrow_integral || multiply_may_overflow;
165
29
            }
166
0
            return false;
167
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
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
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
29
                using FromFieldType = typename FromDataType::FieldType;
124
29
                using ToFieldType = typename ToDataType::FieldType;
125
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
29
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
29
                UInt32 to_max_digits = 0;
137
29
                UInt32 to_precision = 0;
138
29
                UInt32 to_scale = 0;
139
140
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
29
                    const auto* to_decimal_type =
144
29
                            check_and_get_data_type<ToDataType>(to_type.get());
145
29
                    to_precision = to_decimal_type->get_precision();
146
29
                    ToDataType::check_type_precision(to_precision);
147
148
29
                    to_scale = to_decimal_type->get_scale();
149
29
                    ToDataType::check_type_scale(to_scale);
150
29
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
29
                if (to_scale > from_scale) {
161
18
                    multiply_may_overflow &=
162
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
18
                }
164
29
                return narrow_integral || multiply_may_overflow;
165
29
            }
166
0
            return false;
167
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
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
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
29
                using FromFieldType = typename FromDataType::FieldType;
124
29
                using ToFieldType = typename ToDataType::FieldType;
125
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
29
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
29
                UInt32 to_max_digits = 0;
137
29
                UInt32 to_precision = 0;
138
29
                UInt32 to_scale = 0;
139
140
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
29
                    const auto* to_decimal_type =
144
29
                            check_and_get_data_type<ToDataType>(to_type.get());
145
29
                    to_precision = to_decimal_type->get_precision();
146
29
                    ToDataType::check_type_precision(to_precision);
147
148
29
                    to_scale = to_decimal_type->get_scale();
149
29
                    ToDataType::check_type_scale(to_scale);
150
29
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
29
                if (to_scale > from_scale) {
161
18
                    multiply_may_overflow &=
162
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
18
                }
164
29
                return narrow_integral || multiply_may_overflow;
165
29
            }
166
0
            return false;
167
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
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
44
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
44
                using FromFieldType = typename FromDataType::FieldType;
124
44
                using ToFieldType = typename ToDataType::FieldType;
125
44
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
44
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
44
                UInt32 to_max_digits = 0;
137
44
                UInt32 to_precision = 0;
138
44
                UInt32 to_scale = 0;
139
140
44
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
44
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
44
                    const auto* to_decimal_type =
144
44
                            check_and_get_data_type<ToDataType>(to_type.get());
145
44
                    to_precision = to_decimal_type->get_precision();
146
44
                    ToDataType::check_type_precision(to_precision);
147
148
44
                    to_scale = to_decimal_type->get_scale();
149
44
                    ToDataType::check_type_scale(to_scale);
150
44
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
44
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
44
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
44
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
44
                if (to_scale > from_scale) {
161
28
                    multiply_may_overflow &=
162
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
28
                }
164
44
                return narrow_integral || multiply_may_overflow;
165
44
            }
166
0
            return false;
167
44
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
114
87
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
87
            using Types2 = std::decay_t<decltype(types2)>;
116
87
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
87
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
87
                using FromFieldType = typename FromDataType::FieldType;
124
87
                using ToFieldType = typename ToDataType::FieldType;
125
87
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
87
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
87
                UInt32 to_max_digits = 0;
137
87
                UInt32 to_precision = 0;
138
87
                UInt32 to_scale = 0;
139
140
87
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
87
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
87
                    const auto* to_decimal_type =
144
87
                            check_and_get_data_type<ToDataType>(to_type.get());
145
87
                    to_precision = to_decimal_type->get_precision();
146
87
                    ToDataType::check_type_precision(to_precision);
147
148
87
                    to_scale = to_decimal_type->get_scale();
149
87
                    ToDataType::check_type_scale(to_scale);
150
87
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
87
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
87
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
87
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
87
                if (to_scale > from_scale) {
161
66
                    multiply_may_overflow &=
162
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
66
                }
164
87
                return narrow_integral || multiply_may_overflow;
165
87
            }
166
0
            return false;
167
87
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
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
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
99
                using FromFieldType = typename FromDataType::FieldType;
124
99
                using ToFieldType = typename ToDataType::FieldType;
125
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
99
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
99
                UInt32 to_max_digits = 0;
137
99
                UInt32 to_precision = 0;
138
99
                UInt32 to_scale = 0;
139
140
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
99
                    const auto* to_decimal_type =
144
99
                            check_and_get_data_type<ToDataType>(to_type.get());
145
99
                    to_precision = to_decimal_type->get_precision();
146
99
                    ToDataType::check_type_precision(to_precision);
147
148
99
                    to_scale = to_decimal_type->get_scale();
149
99
                    ToDataType::check_type_scale(to_scale);
150
99
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
99
                if (to_scale > from_scale) {
161
66
                    multiply_may_overflow &=
162
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
66
                }
164
99
                return narrow_integral || multiply_may_overflow;
165
99
            }
166
0
            return false;
167
99
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
114
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
168
            using Types2 = std::decay_t<decltype(types2)>;
116
168
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
168
                using FromFieldType = typename FromDataType::FieldType;
124
168
                using ToFieldType = typename ToDataType::FieldType;
125
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
168
                UInt32 from_scale = 0;
127
128
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
168
                    const auto* from_decimal_type =
130
168
                            check_and_get_data_type<FromDataType>(from_type.get());
131
168
                    from_precision =
132
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
168
                    from_scale = from_decimal_type->get_scale();
134
168
                }
135
136
168
                UInt32 to_max_digits = 0;
137
168
                UInt32 to_precision = 0;
138
168
                UInt32 to_scale = 0;
139
140
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
168
                    const auto* to_decimal_type =
144
168
                            check_and_get_data_type<ToDataType>(to_type.get());
145
168
                    to_precision = to_decimal_type->get_precision();
146
168
                    ToDataType::check_type_precision(to_precision);
147
148
168
                    to_scale = to_decimal_type->get_scale();
149
168
                    ToDataType::check_type_scale(to_scale);
150
168
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
168
                if (to_scale > from_scale) {
161
106
                    multiply_may_overflow &=
162
106
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
106
                }
164
168
                return narrow_integral || multiply_may_overflow;
165
168
            }
166
0
            return false;
167
168
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
114
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
264
            using Types2 = std::decay_t<decltype(types2)>;
116
264
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
264
                using FromFieldType = typename FromDataType::FieldType;
124
264
                using ToFieldType = typename ToDataType::FieldType;
125
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
264
                UInt32 from_scale = 0;
127
128
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
264
                    const auto* from_decimal_type =
130
264
                            check_and_get_data_type<FromDataType>(from_type.get());
131
264
                    from_precision =
132
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
264
                    from_scale = from_decimal_type->get_scale();
134
264
                }
135
136
264
                UInt32 to_max_digits = 0;
137
264
                UInt32 to_precision = 0;
138
264
                UInt32 to_scale = 0;
139
140
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
264
                    const auto* to_decimal_type =
144
264
                            check_and_get_data_type<ToDataType>(to_type.get());
145
264
                    to_precision = to_decimal_type->get_precision();
146
264
                    ToDataType::check_type_precision(to_precision);
147
148
264
                    to_scale = to_decimal_type->get_scale();
149
264
                    ToDataType::check_type_scale(to_scale);
150
264
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
264
                if (to_scale > from_scale) {
161
160
                    multiply_may_overflow &=
162
160
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
160
                }
164
264
                return narrow_integral || multiply_may_overflow;
165
264
            }
166
0
            return false;
167
264
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
114
132
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
132
            using Types2 = std::decay_t<decltype(types2)>;
116
132
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
132
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
132
                using FromFieldType = typename FromDataType::FieldType;
124
132
                using ToFieldType = typename ToDataType::FieldType;
125
132
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
132
                UInt32 from_scale = 0;
127
128
132
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
132
                    const auto* from_decimal_type =
130
132
                            check_and_get_data_type<FromDataType>(from_type.get());
131
132
                    from_precision =
132
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
132
                    from_scale = from_decimal_type->get_scale();
134
132
                }
135
136
132
                UInt32 to_max_digits = 0;
137
132
                UInt32 to_precision = 0;
138
132
                UInt32 to_scale = 0;
139
140
132
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
132
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
132
                    const auto* to_decimal_type =
144
132
                            check_and_get_data_type<ToDataType>(to_type.get());
145
132
                    to_precision = to_decimal_type->get_precision();
146
132
                    ToDataType::check_type_precision(to_precision);
147
148
132
                    to_scale = to_decimal_type->get_scale();
149
132
                    ToDataType::check_type_scale(to_scale);
150
132
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
132
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
132
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
132
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
132
                if (to_scale > from_scale) {
161
68
                    multiply_may_overflow &=
162
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
68
                }
164
132
                return narrow_integral || multiply_may_overflow;
165
132
            }
166
0
            return false;
167
132
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
114
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
264
            using Types2 = std::decay_t<decltype(types2)>;
116
264
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
264
                using FromFieldType = typename FromDataType::FieldType;
124
264
                using ToFieldType = typename ToDataType::FieldType;
125
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
264
                UInt32 from_scale = 0;
127
128
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
264
                    const auto* from_decimal_type =
130
264
                            check_and_get_data_type<FromDataType>(from_type.get());
131
264
                    from_precision =
132
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
264
                    from_scale = from_decimal_type->get_scale();
134
264
                }
135
136
264
                UInt32 to_max_digits = 0;
137
264
                UInt32 to_precision = 0;
138
264
                UInt32 to_scale = 0;
139
140
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
264
                    const auto* to_decimal_type =
144
264
                            check_and_get_data_type<ToDataType>(to_type.get());
145
264
                    to_precision = to_decimal_type->get_precision();
146
264
                    ToDataType::check_type_precision(to_precision);
147
148
264
                    to_scale = to_decimal_type->get_scale();
149
264
                    ToDataType::check_type_scale(to_scale);
150
264
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
264
                if (to_scale > from_scale) {
161
159
                    multiply_may_overflow &=
162
159
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
159
                }
164
264
                return narrow_integral || multiply_may_overflow;
165
264
            }
166
0
            return false;
167
264
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
114
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
272
            using Types2 = std::decay_t<decltype(types2)>;
116
272
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
                return false;
121
            }
122
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
272
                using FromFieldType = typename FromDataType::FieldType;
124
272
                using ToFieldType = typename ToDataType::FieldType;
125
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
272
                UInt32 from_scale = 0;
127
128
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
272
                    const auto* from_decimal_type =
130
272
                            check_and_get_data_type<FromDataType>(from_type.get());
131
272
                    from_precision =
132
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
272
                    from_scale = from_decimal_type->get_scale();
134
272
                }
135
136
272
                UInt32 to_max_digits = 0;
137
272
                UInt32 to_precision = 0;
138
272
                UInt32 to_scale = 0;
139
140
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
272
                    const auto* to_decimal_type =
144
272
                            check_and_get_data_type<ToDataType>(to_type.get());
145
272
                    to_precision = to_decimal_type->get_precision();
146
272
                    ToDataType::check_type_precision(to_precision);
147
148
272
                    to_scale = to_decimal_type->get_scale();
149
272
                    ToDataType::check_type_scale(to_scale);
150
272
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
272
                if (to_scale > from_scale) {
161
152
                    multiply_may_overflow &=
162
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
152
                }
164
272
                return narrow_integral || multiply_may_overflow;
165
272
            }
166
0
            return false;
167
272
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
114
1.39k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.39k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.39k
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
1.39k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1.39k
                return false;
121
1.39k
            }
122
1.39k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1.39k
                using FromFieldType = typename FromDataType::FieldType;
124
1.39k
                using ToFieldType = typename ToDataType::FieldType;
125
1.39k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1.39k
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_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.39k
                UInt32 to_max_digits = 0;
137
1.39k
                UInt32 to_precision = 0;
138
1.39k
                UInt32 to_scale = 0;
139
140
1.39k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1.39k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1.39k
                    const auto* to_decimal_type =
144
1.39k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1.39k
                    to_precision = to_decimal_type->get_precision();
146
1.39k
                    ToDataType::check_type_precision(to_precision);
147
148
1.39k
                    to_scale = to_decimal_type->get_scale();
149
1.39k
                    ToDataType::check_type_scale(to_scale);
150
1.39k
                }
151
                if constexpr (IsIntegralV<ToFieldType> || 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.39k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1.39k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1.39k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1.39k
                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.39k
                return narrow_integral || multiply_may_overflow;
165
1.39k
            }
166
0
            return false;
167
1.39k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
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_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Line
Count
Source
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_16DataTypeDateTimeESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Line
Count
Source
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
51
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
51
            using Types2 = std::decay_t<decltype(types2)>;
116
51
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
51
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
51
                return false;
121
51
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
51
            return false;
167
51
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
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_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
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_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Line
Count
Source
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
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
4
                using FromFieldType = typename FromDataType::FieldType;
124
4
                using ToFieldType = typename ToDataType::FieldType;
125
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
4
                UInt32 from_scale = 0;
127
128
4
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
4
                    const auto* from_decimal_type =
130
4
                            check_and_get_data_type<FromDataType>(from_type.get());
131
4
                    from_precision =
132
4
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
4
                    from_scale = from_decimal_type->get_scale();
134
4
                }
135
136
4
                UInt32 to_max_digits = 0;
137
4
                UInt32 to_precision = 0;
138
4
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || 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
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
4
                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
                return narrow_integral || multiply_may_overflow;
165
4
            }
166
0
            return false;
167
4
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Line
Count
Source
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_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Line
Count
Source
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_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
114
50
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
50
            using Types2 = std::decay_t<decltype(types2)>;
116
50
            using FromDataType = typename Types2::LeftType;
117
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
50
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
50
                return false;
121
50
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
161
                    multiply_may_overflow &=
162
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
                }
164
                return narrow_integral || multiply_may_overflow;
165
            }
166
50
            return false;
167
50
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
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_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
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_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Line
Count
Source
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
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Line
Count
Source
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_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
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
12
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
12
                return false;
121
12
            }
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
                using FromFieldType = typename FromDataType::FieldType;
124
                using ToFieldType = typename ToDataType::FieldType;
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
                UInt32 from_scale = 0;
127
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
                    const auto* from_decimal_type =
130
                            check_and_get_data_type<FromDataType>(from_type.get());
131
                    from_precision =
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
                    from_scale = from_decimal_type->get_scale();
134
                }
135
136
                UInt32 to_max_digits = 0;
137
                UInt32 to_precision = 0;
138
                UInt32 to_scale = 0;
139
140
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
                    const auto* to_decimal_type =
144
                            check_and_get_data_type<ToDataType>(to_type.get());
145
                    to_precision = to_decimal_type->get_precision();
146
                    ToDataType::check_type_precision(to_precision);
147
148
                    to_scale = to_decimal_type->get_scale();
149
                    ToDataType::check_type_scale(to_scale);
150
                }
151
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
                    to_precision = to_max_digits;
154
                }
155
156
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
                if (to_scale > from_scale) {
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
        });
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
35.2k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
104
48
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
48
        using Types = std::decay_t<decltype(types)>;
106
48
        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
48
        return call_on_index_and_data_type<
114
48
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
48
            using Types2 = std::decay_t<decltype(types2)>;
116
48
            using FromDataType = typename Types2::LeftType;
117
48
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
48
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
48
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
48
                return false;
121
48
            }
122
48
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
48
                using FromFieldType = typename FromDataType::FieldType;
124
48
                using ToFieldType = typename ToDataType::FieldType;
125
48
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
48
                UInt32 from_scale = 0;
127
128
48
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
48
                    const auto* from_decimal_type =
130
48
                            check_and_get_data_type<FromDataType>(from_type.get());
131
48
                    from_precision =
132
48
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
48
                    from_scale = from_decimal_type->get_scale();
134
48
                }
135
136
48
                UInt32 to_max_digits = 0;
137
48
                UInt32 to_precision = 0;
138
48
                UInt32 to_scale = 0;
139
140
48
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
48
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
48
                    const auto* to_decimal_type =
144
48
                            check_and_get_data_type<ToDataType>(to_type.get());
145
48
                    to_precision = to_decimal_type->get_precision();
146
48
                    ToDataType::check_type_precision(to_precision);
147
148
48
                    to_scale = to_decimal_type->get_scale();
149
48
                    ToDataType::check_type_scale(to_scale);
150
48
                }
151
48
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
48
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
48
                    to_precision = to_max_digits;
154
48
                }
155
156
48
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
48
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
48
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
48
                if (to_scale > from_scale) {
161
48
                    multiply_may_overflow &=
162
48
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
48
                }
164
48
                return narrow_integral || multiply_may_overflow;
165
48
            }
166
48
            return false;
167
48
        });
168
48
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
104
1.44k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
1.44k
        using Types = std::decay_t<decltype(types)>;
106
1.44k
        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
1.44k
        return call_on_index_and_data_type<
114
1.44k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.44k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.44k
            using FromDataType = typename Types2::LeftType;
117
1.44k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
1.44k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
1.44k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1.44k
                return false;
121
1.44k
            }
122
1.44k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1.44k
                using FromFieldType = typename FromDataType::FieldType;
124
1.44k
                using ToFieldType = typename ToDataType::FieldType;
125
1.44k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1.44k
                UInt32 from_scale = 0;
127
128
1.44k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
1.44k
                    const auto* from_decimal_type =
130
1.44k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
1.44k
                    from_precision =
132
1.44k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
1.44k
                    from_scale = from_decimal_type->get_scale();
134
1.44k
                }
135
136
1.44k
                UInt32 to_max_digits = 0;
137
1.44k
                UInt32 to_precision = 0;
138
1.44k
                UInt32 to_scale = 0;
139
140
1.44k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1.44k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1.44k
                    const auto* to_decimal_type =
144
1.44k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1.44k
                    to_precision = to_decimal_type->get_precision();
146
1.44k
                    ToDataType::check_type_precision(to_precision);
147
148
1.44k
                    to_scale = to_decimal_type->get_scale();
149
1.44k
                    ToDataType::check_type_scale(to_scale);
150
1.44k
                }
151
1.44k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
1.44k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
1.44k
                    to_precision = to_max_digits;
154
1.44k
                }
155
156
1.44k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1.44k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1.44k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1.44k
                if (to_scale > from_scale) {
161
1.44k
                    multiply_may_overflow &=
162
1.44k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
1.44k
                }
164
1.44k
                return narrow_integral || multiply_may_overflow;
165
1.44k
            }
166
1.44k
            return false;
167
1.44k
        });
168
1.44k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
104
1.42k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
1.42k
        using Types = std::decay_t<decltype(types)>;
106
1.42k
        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
1.42k
        return call_on_index_and_data_type<
114
1.42k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.42k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.42k
            using FromDataType = typename Types2::LeftType;
117
1.42k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
1.42k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
1.42k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1.42k
                return false;
121
1.42k
            }
122
1.42k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1.42k
                using FromFieldType = typename FromDataType::FieldType;
124
1.42k
                using ToFieldType = typename ToDataType::FieldType;
125
1.42k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1.42k
                UInt32 from_scale = 0;
127
128
1.42k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
1.42k
                    const auto* from_decimal_type =
130
1.42k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
1.42k
                    from_precision =
132
1.42k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
1.42k
                    from_scale = from_decimal_type->get_scale();
134
1.42k
                }
135
136
1.42k
                UInt32 to_max_digits = 0;
137
1.42k
                UInt32 to_precision = 0;
138
1.42k
                UInt32 to_scale = 0;
139
140
1.42k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1.42k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1.42k
                    const auto* to_decimal_type =
144
1.42k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1.42k
                    to_precision = to_decimal_type->get_precision();
146
1.42k
                    ToDataType::check_type_precision(to_precision);
147
148
1.42k
                    to_scale = to_decimal_type->get_scale();
149
1.42k
                    ToDataType::check_type_scale(to_scale);
150
1.42k
                }
151
1.42k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
1.42k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
1.42k
                    to_precision = to_max_digits;
154
1.42k
                }
155
156
1.42k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1.42k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1.42k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1.42k
                if (to_scale > from_scale) {
161
1.42k
                    multiply_may_overflow &=
162
1.42k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
1.42k
                }
164
1.42k
                return narrow_integral || multiply_may_overflow;
165
1.42k
            }
166
1.42k
            return false;
167
1.42k
        });
168
1.42k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
104
1.28k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
1.28k
        using Types = std::decay_t<decltype(types)>;
106
1.28k
        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
1.28k
        return call_on_index_and_data_type<
114
1.28k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.28k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.28k
            using FromDataType = typename Types2::LeftType;
117
1.28k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
1.28k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
1.28k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1.28k
                return false;
121
1.28k
            }
122
1.28k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1.28k
                using FromFieldType = typename FromDataType::FieldType;
124
1.28k
                using ToFieldType = typename ToDataType::FieldType;
125
1.28k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1.28k
                UInt32 from_scale = 0;
127
128
1.28k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
1.28k
                    const auto* from_decimal_type =
130
1.28k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
1.28k
                    from_precision =
132
1.28k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
1.28k
                    from_scale = from_decimal_type->get_scale();
134
1.28k
                }
135
136
1.28k
                UInt32 to_max_digits = 0;
137
1.28k
                UInt32 to_precision = 0;
138
1.28k
                UInt32 to_scale = 0;
139
140
1.28k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1.28k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1.28k
                    const auto* to_decimal_type =
144
1.28k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1.28k
                    to_precision = to_decimal_type->get_precision();
146
1.28k
                    ToDataType::check_type_precision(to_precision);
147
148
1.28k
                    to_scale = to_decimal_type->get_scale();
149
1.28k
                    ToDataType::check_type_scale(to_scale);
150
1.28k
                }
151
1.28k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
1.28k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
1.28k
                    to_precision = to_max_digits;
154
1.28k
                }
155
156
1.28k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1.28k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1.28k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1.28k
                if (to_scale > from_scale) {
161
1.28k
                    multiply_may_overflow &=
162
1.28k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
1.28k
                }
164
1.28k
                return narrow_integral || multiply_may_overflow;
165
1.28k
            }
166
1.28k
            return false;
167
1.28k
        });
168
1.28k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
104
1.04k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
1.04k
        using Types = std::decay_t<decltype(types)>;
106
1.04k
        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
1.04k
        return call_on_index_and_data_type<
114
1.04k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.04k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.04k
            using FromDataType = typename Types2::LeftType;
117
1.04k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
1.04k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
1.04k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1.04k
                return false;
121
1.04k
            }
122
1.04k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1.04k
                using FromFieldType = typename FromDataType::FieldType;
124
1.04k
                using ToFieldType = typename ToDataType::FieldType;
125
1.04k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1.04k
                UInt32 from_scale = 0;
127
128
1.04k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
1.04k
                    const auto* from_decimal_type =
130
1.04k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
1.04k
                    from_precision =
132
1.04k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
1.04k
                    from_scale = from_decimal_type->get_scale();
134
1.04k
                }
135
136
1.04k
                UInt32 to_max_digits = 0;
137
1.04k
                UInt32 to_precision = 0;
138
1.04k
                UInt32 to_scale = 0;
139
140
1.04k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1.04k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1.04k
                    const auto* to_decimal_type =
144
1.04k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1.04k
                    to_precision = to_decimal_type->get_precision();
146
1.04k
                    ToDataType::check_type_precision(to_precision);
147
148
1.04k
                    to_scale = to_decimal_type->get_scale();
149
1.04k
                    ToDataType::check_type_scale(to_scale);
150
1.04k
                }
151
1.04k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
1.04k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
1.04k
                    to_precision = to_max_digits;
154
1.04k
                }
155
156
1.04k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1.04k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1.04k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1.04k
                if (to_scale > from_scale) {
161
1.04k
                    multiply_may_overflow &=
162
1.04k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
1.04k
                }
164
1.04k
                return narrow_integral || multiply_may_overflow;
165
1.04k
            }
166
1.04k
            return false;
167
1.04k
        });
168
1.04k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
104
1.08k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
1.08k
        using Types = std::decay_t<decltype(types)>;
106
1.08k
        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
1.08k
        return call_on_index_and_data_type<
114
1.08k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
1.08k
            using Types2 = std::decay_t<decltype(types2)>;
116
1.08k
            using FromDataType = typename Types2::LeftType;
117
1.08k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
1.08k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
1.08k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
1.08k
                return false;
121
1.08k
            }
122
1.08k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
1.08k
                using FromFieldType = typename FromDataType::FieldType;
124
1.08k
                using ToFieldType = typename ToDataType::FieldType;
125
1.08k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
1.08k
                UInt32 from_scale = 0;
127
128
1.08k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
1.08k
                    const auto* from_decimal_type =
130
1.08k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
1.08k
                    from_precision =
132
1.08k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
1.08k
                    from_scale = from_decimal_type->get_scale();
134
1.08k
                }
135
136
1.08k
                UInt32 to_max_digits = 0;
137
1.08k
                UInt32 to_precision = 0;
138
1.08k
                UInt32 to_scale = 0;
139
140
1.08k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
1.08k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
1.08k
                    const auto* to_decimal_type =
144
1.08k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
1.08k
                    to_precision = to_decimal_type->get_precision();
146
1.08k
                    ToDataType::check_type_precision(to_precision);
147
148
1.08k
                    to_scale = to_decimal_type->get_scale();
149
1.08k
                    ToDataType::check_type_scale(to_scale);
150
1.08k
                }
151
1.08k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
1.08k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
1.08k
                    to_precision = to_max_digits;
154
1.08k
                }
155
156
1.08k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
1.08k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
1.08k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
1.08k
                if (to_scale > from_scale) {
161
1.08k
                    multiply_may_overflow &=
162
1.08k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
1.08k
                }
164
1.08k
                return narrow_integral || multiply_may_overflow;
165
1.08k
            }
166
1.08k
            return false;
167
1.08k
        });
168
1.08k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
104
8.17k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
8.17k
        using Types = std::decay_t<decltype(types)>;
106
8.17k
        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
8.17k
        return call_on_index_and_data_type<
114
8.17k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
8.17k
            using Types2 = std::decay_t<decltype(types2)>;
116
8.17k
            using FromDataType = typename Types2::LeftType;
117
8.17k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
8.17k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
8.17k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
8.17k
                return false;
121
8.17k
            }
122
8.17k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
8.17k
                using FromFieldType = typename FromDataType::FieldType;
124
8.17k
                using ToFieldType = typename ToDataType::FieldType;
125
8.17k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
8.17k
                UInt32 from_scale = 0;
127
128
8.17k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
8.17k
                    const auto* from_decimal_type =
130
8.17k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
8.17k
                    from_precision =
132
8.17k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
8.17k
                    from_scale = from_decimal_type->get_scale();
134
8.17k
                }
135
136
8.17k
                UInt32 to_max_digits = 0;
137
8.17k
                UInt32 to_precision = 0;
138
8.17k
                UInt32 to_scale = 0;
139
140
8.17k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
8.17k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
8.17k
                    const auto* to_decimal_type =
144
8.17k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
8.17k
                    to_precision = to_decimal_type->get_precision();
146
8.17k
                    ToDataType::check_type_precision(to_precision);
147
148
8.17k
                    to_scale = to_decimal_type->get_scale();
149
8.17k
                    ToDataType::check_type_scale(to_scale);
150
8.17k
                }
151
8.17k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
8.17k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
8.17k
                    to_precision = to_max_digits;
154
8.17k
                }
155
156
8.17k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
8.17k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
8.17k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
8.17k
                if (to_scale > from_scale) {
161
8.17k
                    multiply_may_overflow &=
162
8.17k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
8.17k
                }
164
8.17k
                return narrow_integral || multiply_may_overflow;
165
8.17k
            }
166
8.17k
            return false;
167
8.17k
        });
168
8.17k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
104
8.24k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
8.24k
        using Types = std::decay_t<decltype(types)>;
106
8.24k
        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
8.24k
        return call_on_index_and_data_type<
114
8.24k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
8.24k
            using Types2 = std::decay_t<decltype(types2)>;
116
8.24k
            using FromDataType = typename Types2::LeftType;
117
8.24k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
8.24k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
8.24k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
8.24k
                return false;
121
8.24k
            }
122
8.24k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
8.24k
                using FromFieldType = typename FromDataType::FieldType;
124
8.24k
                using ToFieldType = typename ToDataType::FieldType;
125
8.24k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
8.24k
                UInt32 from_scale = 0;
127
128
8.24k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
8.24k
                    const auto* from_decimal_type =
130
8.24k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
8.24k
                    from_precision =
132
8.24k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
8.24k
                    from_scale = from_decimal_type->get_scale();
134
8.24k
                }
135
136
8.24k
                UInt32 to_max_digits = 0;
137
8.24k
                UInt32 to_precision = 0;
138
8.24k
                UInt32 to_scale = 0;
139
140
8.24k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
8.24k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
8.24k
                    const auto* to_decimal_type =
144
8.24k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
8.24k
                    to_precision = to_decimal_type->get_precision();
146
8.24k
                    ToDataType::check_type_precision(to_precision);
147
148
8.24k
                    to_scale = to_decimal_type->get_scale();
149
8.24k
                    ToDataType::check_type_scale(to_scale);
150
8.24k
                }
151
8.24k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
8.24k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
8.24k
                    to_precision = to_max_digits;
154
8.24k
                }
155
156
8.24k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
8.24k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
8.24k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
8.24k
                if (to_scale > from_scale) {
161
8.24k
                    multiply_may_overflow &=
162
8.24k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
8.24k
                }
164
8.24k
                return narrow_integral || multiply_may_overflow;
165
8.24k
            }
166
8.24k
            return false;
167
8.24k
        });
168
8.24k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
104
3.23k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
3.23k
        using Types = std::decay_t<decltype(types)>;
106
3.23k
        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.23k
        return call_on_index_and_data_type<
114
3.23k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3.23k
            using Types2 = std::decay_t<decltype(types2)>;
116
3.23k
            using FromDataType = typename Types2::LeftType;
117
3.23k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
3.23k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
3.23k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
3.23k
                return false;
121
3.23k
            }
122
3.23k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
3.23k
                using FromFieldType = typename FromDataType::FieldType;
124
3.23k
                using ToFieldType = typename ToDataType::FieldType;
125
3.23k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
3.23k
                UInt32 from_scale = 0;
127
128
3.23k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
3.23k
                    const auto* from_decimal_type =
130
3.23k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
3.23k
                    from_precision =
132
3.23k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
3.23k
                    from_scale = from_decimal_type->get_scale();
134
3.23k
                }
135
136
3.23k
                UInt32 to_max_digits = 0;
137
3.23k
                UInt32 to_precision = 0;
138
3.23k
                UInt32 to_scale = 0;
139
140
3.23k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
3.23k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
3.23k
                    const auto* to_decimal_type =
144
3.23k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
3.23k
                    to_precision = to_decimal_type->get_precision();
146
3.23k
                    ToDataType::check_type_precision(to_precision);
147
148
3.23k
                    to_scale = to_decimal_type->get_scale();
149
3.23k
                    ToDataType::check_type_scale(to_scale);
150
3.23k
                }
151
3.23k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
3.23k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
3.23k
                    to_precision = to_max_digits;
154
3.23k
                }
155
156
3.23k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
3.23k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
3.23k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
3.23k
                if (to_scale > from_scale) {
161
3.23k
                    multiply_may_overflow &=
162
3.23k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
3.23k
                }
164
3.23k
                return narrow_integral || multiply_may_overflow;
165
3.23k
            }
166
3.23k
            return false;
167
3.23k
        });
168
3.23k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
104
3.21k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
3.21k
        using Types = std::decay_t<decltype(types)>;
106
3.21k
        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.21k
        return call_on_index_and_data_type<
114
3.21k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3.21k
            using Types2 = std::decay_t<decltype(types2)>;
116
3.21k
            using FromDataType = typename Types2::LeftType;
117
3.21k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
3.21k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
3.21k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
3.21k
                return false;
121
3.21k
            }
122
3.21k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
3.21k
                using FromFieldType = typename FromDataType::FieldType;
124
3.21k
                using ToFieldType = typename ToDataType::FieldType;
125
3.21k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
3.21k
                UInt32 from_scale = 0;
127
128
3.21k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
3.21k
                    const auto* from_decimal_type =
130
3.21k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
3.21k
                    from_precision =
132
3.21k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
3.21k
                    from_scale = from_decimal_type->get_scale();
134
3.21k
                }
135
136
3.21k
                UInt32 to_max_digits = 0;
137
3.21k
                UInt32 to_precision = 0;
138
3.21k
                UInt32 to_scale = 0;
139
140
3.21k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
3.21k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
3.21k
                    const auto* to_decimal_type =
144
3.21k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
3.21k
                    to_precision = to_decimal_type->get_precision();
146
3.21k
                    ToDataType::check_type_precision(to_precision);
147
148
3.21k
                    to_scale = to_decimal_type->get_scale();
149
3.21k
                    ToDataType::check_type_scale(to_scale);
150
3.21k
                }
151
3.21k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
3.21k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
3.21k
                    to_precision = to_max_digits;
154
3.21k
                }
155
156
3.21k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
3.21k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
3.21k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
3.21k
                if (to_scale > from_scale) {
161
3.21k
                    multiply_may_overflow &=
162
3.21k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
3.21k
                }
164
3.21k
                return narrow_integral || multiply_may_overflow;
165
3.21k
            }
166
3.21k
            return false;
167
3.21k
        });
168
3.21k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
104
4
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
4
        using Types = std::decay_t<decltype(types)>;
106
4
        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
        return call_on_index_and_data_type<
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
4
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
4
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
4
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
4
                return false;
121
4
            }
122
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
4
                using FromFieldType = typename FromDataType::FieldType;
124
4
                using ToFieldType = typename ToDataType::FieldType;
125
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
4
                UInt32 from_scale = 0;
127
128
4
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
4
                    const auto* from_decimal_type =
130
4
                            check_and_get_data_type<FromDataType>(from_type.get());
131
4
                    from_precision =
132
4
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
4
                    from_scale = from_decimal_type->get_scale();
134
4
                }
135
136
4
                UInt32 to_max_digits = 0;
137
4
                UInt32 to_precision = 0;
138
4
                UInt32 to_scale = 0;
139
140
4
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
4
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
4
                    const auto* to_decimal_type =
144
4
                            check_and_get_data_type<ToDataType>(to_type.get());
145
4
                    to_precision = to_decimal_type->get_precision();
146
4
                    ToDataType::check_type_precision(to_precision);
147
148
4
                    to_scale = to_decimal_type->get_scale();
149
4
                    ToDataType::check_type_scale(to_scale);
150
4
                }
151
4
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
4
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
4
                    to_precision = to_max_digits;
154
4
                }
155
156
4
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
4
                if (to_scale > from_scale) {
161
4
                    multiply_may_overflow &=
162
4
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
4
                }
164
4
                return narrow_integral || multiply_may_overflow;
165
4
            }
166
4
            return false;
167
4
        });
168
4
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
104
3.01k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
3.01k
        using Types = std::decay_t<decltype(types)>;
106
3.01k
        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.01k
        return call_on_index_and_data_type<
114
3.01k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
3.01k
            using Types2 = std::decay_t<decltype(types2)>;
116
3.01k
            using FromDataType = typename Types2::LeftType;
117
3.01k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
3.01k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
3.01k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
3.01k
                return false;
121
3.01k
            }
122
3.01k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
3.01k
                using FromFieldType = typename FromDataType::FieldType;
124
3.01k
                using ToFieldType = typename ToDataType::FieldType;
125
3.01k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
3.01k
                UInt32 from_scale = 0;
127
128
3.01k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
3.01k
                    const auto* from_decimal_type =
130
3.01k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
3.01k
                    from_precision =
132
3.01k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
3.01k
                    from_scale = from_decimal_type->get_scale();
134
3.01k
                }
135
136
3.01k
                UInt32 to_max_digits = 0;
137
3.01k
                UInt32 to_precision = 0;
138
3.01k
                UInt32 to_scale = 0;
139
140
3.01k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
3.01k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
3.01k
                    const auto* to_decimal_type =
144
3.01k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
3.01k
                    to_precision = to_decimal_type->get_precision();
146
3.01k
                    ToDataType::check_type_precision(to_precision);
147
148
3.01k
                    to_scale = to_decimal_type->get_scale();
149
3.01k
                    ToDataType::check_type_scale(to_scale);
150
3.01k
                }
151
3.01k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
3.01k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
3.01k
                    to_precision = to_max_digits;
154
3.01k
                }
155
156
3.01k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
3.01k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
3.01k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
3.01k
                if (to_scale > from_scale) {
161
3.01k
                    multiply_may_overflow &=
162
3.01k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
3.01k
                }
164
3.01k
                return narrow_integral || multiply_may_overflow;
165
3.01k
            }
166
3.01k
            return false;
167
3.01k
        });
168
3.01k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_
Line
Count
Source
104
2.84k
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
2.84k
        using Types = std::decay_t<decltype(types)>;
106
2.84k
        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.84k
        return call_on_index_and_data_type<
114
2.84k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
2.84k
            using Types2 = std::decay_t<decltype(types2)>;
116
2.84k
            using FromDataType = typename Types2::LeftType;
117
2.84k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
2.84k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
2.84k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
2.84k
                return false;
121
2.84k
            }
122
2.84k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
2.84k
                using FromFieldType = typename FromDataType::FieldType;
124
2.84k
                using ToFieldType = typename ToDataType::FieldType;
125
2.84k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
2.84k
                UInt32 from_scale = 0;
127
128
2.84k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
2.84k
                    const auto* from_decimal_type =
130
2.84k
                            check_and_get_data_type<FromDataType>(from_type.get());
131
2.84k
                    from_precision =
132
2.84k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
2.84k
                    from_scale = from_decimal_type->get_scale();
134
2.84k
                }
135
136
2.84k
                UInt32 to_max_digits = 0;
137
2.84k
                UInt32 to_precision = 0;
138
2.84k
                UInt32 to_scale = 0;
139
140
2.84k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
2.84k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
2.84k
                    const auto* to_decimal_type =
144
2.84k
                            check_and_get_data_type<ToDataType>(to_type.get());
145
2.84k
                    to_precision = to_decimal_type->get_precision();
146
2.84k
                    ToDataType::check_type_precision(to_precision);
147
148
2.84k
                    to_scale = to_decimal_type->get_scale();
149
2.84k
                    ToDataType::check_type_scale(to_scale);
150
2.84k
                }
151
2.84k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
2.84k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
2.84k
                    to_precision = to_max_digits;
154
2.84k
                }
155
156
2.84k
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
2.84k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
2.84k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
2.84k
                if (to_scale > from_scale) {
161
2.84k
                    multiply_may_overflow &=
162
2.84k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
2.84k
                }
164
2.84k
                return narrow_integral || multiply_may_overflow;
165
2.84k
            }
166
2.84k
            return false;
167
2.84k
        });
168
2.84k
    };
Unexecuted instantiation: function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_
Line
Count
Source
104
71
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
71
        using Types = std::decay_t<decltype(types)>;
106
71
        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
71
        return call_on_index_and_data_type<
114
71
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
71
            using Types2 = std::decay_t<decltype(types2)>;
116
71
            using FromDataType = typename Types2::LeftType;
117
71
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
71
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
71
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
71
                return false;
121
71
            }
122
71
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
71
                using FromFieldType = typename FromDataType::FieldType;
124
71
                using ToFieldType = typename ToDataType::FieldType;
125
71
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
71
                UInt32 from_scale = 0;
127
128
71
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
71
                    const auto* from_decimal_type =
130
71
                            check_and_get_data_type<FromDataType>(from_type.get());
131
71
                    from_precision =
132
71
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
71
                    from_scale = from_decimal_type->get_scale();
134
71
                }
135
136
71
                UInt32 to_max_digits = 0;
137
71
                UInt32 to_precision = 0;
138
71
                UInt32 to_scale = 0;
139
140
71
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
71
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
71
                    const auto* to_decimal_type =
144
71
                            check_and_get_data_type<ToDataType>(to_type.get());
145
71
                    to_precision = to_decimal_type->get_precision();
146
71
                    ToDataType::check_type_precision(to_precision);
147
148
71
                    to_scale = to_decimal_type->get_scale();
149
71
                    ToDataType::check_type_scale(to_scale);
150
71
                }
151
71
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
71
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
71
                    to_precision = to_max_digits;
154
71
                }
155
156
71
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
71
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
71
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
71
                if (to_scale > from_scale) {
161
71
                    multiply_may_overflow &=
162
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
71
                }
164
71
                return narrow_integral || multiply_may_overflow;
165
71
            }
166
71
            return false;
167
71
        });
168
71
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
104
72
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
72
        using Types = std::decay_t<decltype(types)>;
106
72
        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
72
        return call_on_index_and_data_type<
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
72
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
72
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
72
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
72
                return false;
121
72
            }
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
72
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
72
                    const auto* from_decimal_type =
130
72
                            check_and_get_data_type<FromDataType>(from_type.get());
131
72
                    from_precision =
132
72
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
72
                    from_scale = from_decimal_type->get_scale();
134
72
                }
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
72
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
72
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
72
                    to_precision = to_max_digits;
154
72
                }
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
72
                    multiply_may_overflow &=
162
72
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
72
                }
164
72
                return narrow_integral || multiply_may_overflow;
165
72
            }
166
72
            return false;
167
72
        });
168
72
    };
Unexecuted instantiation: function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_
Line
Count
Source
104
16
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
16
        using Types = std::decay_t<decltype(types)>;
106
16
        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
16
        return call_on_index_and_data_type<
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
16
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
16
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
16
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
16
                return false;
121
16
            }
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
16
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
16
                    const auto* from_decimal_type =
130
16
                            check_and_get_data_type<FromDataType>(from_type.get());
131
16
                    from_precision =
132
16
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
16
                    from_scale = from_decimal_type->get_scale();
134
16
                }
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
16
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
16
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
16
                    to_precision = to_max_digits;
154
16
                }
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
16
            return false;
167
16
        });
168
16
    };
Unexecuted instantiation: function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_
Line
Count
Source
104
7
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
7
        using Types = std::decay_t<decltype(types)>;
106
7
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
7
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
7
            return false;
112
7
        }
113
0
        return call_on_index_and_data_type<
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
7
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
7
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
7
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
7
                return false;
121
7
            }
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
7
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
7
                    const auto* from_decimal_type =
130
7
                            check_and_get_data_type<FromDataType>(from_type.get());
131
7
                    from_precision =
132
7
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
7
                    from_scale = from_decimal_type->get_scale();
134
7
                }
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
7
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
7
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
7
                    to_precision = to_max_digits;
154
7
                }
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
7
                    multiply_may_overflow &=
162
7
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
7
                }
164
7
                return narrow_integral || multiply_may_overflow;
165
7
            }
166
7
            return false;
167
7
        });
168
7
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_
Line
Count
Source
104
10
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
10
        using Types = std::decay_t<decltype(types)>;
106
10
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
10
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
10
            return false;
112
10
        }
113
0
        return call_on_index_and_data_type<
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
10
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
10
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
10
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
10
                return false;
121
10
            }
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
10
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
10
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
10
                    const auto* to_decimal_type =
144
10
                            check_and_get_data_type<ToDataType>(to_type.get());
145
10
                    to_precision = to_decimal_type->get_precision();
146
10
                    ToDataType::check_type_precision(to_precision);
147
148
10
                    to_scale = to_decimal_type->get_scale();
149
10
                    ToDataType::check_type_scale(to_scale);
150
10
                }
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
10
                    multiply_may_overflow &=
162
10
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
10
                }
164
10
                return narrow_integral || multiply_may_overflow;
165
10
            }
166
10
            return false;
167
10
        });
168
10
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_
Line
Count
Source
104
31
    auto make_default_wrapper = [&](const auto& types) -> bool {
105
31
        using Types = std::decay_t<decltype(types)>;
106
31
        using ToDataType = typename Types::LeftType;
107
108
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
109
                        IsDatelikeV2Types<ToDataType> ||
110
31
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
111
31
            return false;
112
31
        }
113
0
        return call_on_index_and_data_type<
114
31
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
115
31
            using Types2 = std::decay_t<decltype(types2)>;
116
31
            using FromDataType = typename Types2::LeftType;
117
31
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
118
31
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
119
31
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
120
31
                return false;
121
31
            }
122
31
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
123
31
                using FromFieldType = typename FromDataType::FieldType;
124
31
                using ToFieldType = typename ToDataType::FieldType;
125
31
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
126
31
                UInt32 from_scale = 0;
127
128
31
                if constexpr (IsDataTypeDecimal<FromDataType>) {
129
31
                    const auto* from_decimal_type =
130
31
                            check_and_get_data_type<FromDataType>(from_type.get());
131
31
                    from_precision =
132
31
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
133
31
                    from_scale = from_decimal_type->get_scale();
134
31
                }
135
136
31
                UInt32 to_max_digits = 0;
137
31
                UInt32 to_precision = 0;
138
31
                UInt32 to_scale = 0;
139
140
31
                if constexpr (IsDataTypeDecimal<ToDataType>) {
141
31
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
142
143
31
                    const auto* to_decimal_type =
144
31
                            check_and_get_data_type<ToDataType>(to_type.get());
145
31
                    to_precision = to_decimal_type->get_precision();
146
31
                    ToDataType::check_type_precision(to_precision);
147
148
31
                    to_scale = to_decimal_type->get_scale();
149
31
                    ToDataType::check_type_scale(to_scale);
150
31
                }
151
31
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
152
31
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
153
31
                    to_precision = to_max_digits;
154
31
                }
155
156
31
                bool narrow_integral = context->check_overflow_for_decimal() &&
157
31
                                       (to_precision - to_scale) <= (from_precision - from_scale);
158
159
31
                bool multiply_may_overflow = context->check_overflow_for_decimal();
160
31
                if (to_scale > from_scale) {
161
31
                    multiply_may_overflow &=
162
31
                            (from_precision + to_scale - from_scale) >= to_max_digits;
163
31
                }
164
31
                return narrow_integral || multiply_may_overflow;
165
31
            }
166
31
            return false;
167
31
        });
168
31
    };
169
170
84.8k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
171
84.9k
}
172
173
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
174
85.0k
                                    const DataTypePtr& to_type) {
175
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
176
85.0k
    bool result_is_nullable = to_type->is_nullable();
177
178
85.0k
    if (result_is_nullable) {
179
84.9k
        return [from_type, to_type](FunctionContext* context, Block& block,
180
84.9k
                                    const ColumnNumbers& arguments, uint32_t result,
181
84.9k
                                    size_t input_rows_count,
182
84.9k
                                    const NullMap::value_type* null_map = nullptr) {
183
84.9k
            auto from_type_not_nullable = remove_nullable(from_type);
184
84.9k
            auto to_type_not_nullable = remove_nullable(to_type);
185
186
84.9k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
187
84.9k
                    context, from_type_not_nullable, to_type_not_nullable);
188
189
84.9k
            auto nested_result_index = block.columns();
190
84.9k
            block.insert(block.get_by_position(result).unnest_nullable());
191
84.9k
            auto nested_source_index = block.columns();
192
84.9k
            block.insert(block.get_by_position(arguments[0])
193
84.9k
                                 .unnest_nullable(replace_null_data_to_default));
194
195
84.9k
            const auto& arg_col = block.get_by_position(arguments[0]);
196
84.9k
            const NullMap::value_type* arg_null_map = nullptr;
197
84.9k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
198
84.9k
                arg_null_map = nullable->get_null_map_data().data();
199
84.9k
            }
200
84.9k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
201
84.9k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
202
84.9k
                    arg_null_map));
203
204
61.2k
            block.get_by_position(result).column =
205
61.2k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
206
61.2k
                                     arguments, input_rows_count);
207
208
61.2k
            block.erase(nested_source_index);
209
61.2k
            block.erase(nested_result_index);
210
61.2k
            return Status::OK();
211
84.9k
        };
212
84.9k
    } else {
213
20
        return prepare_impl(context, from_type, to_type);
214
20
    }
215
85.0k
}
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
85.0k
                         const DataTypePtr& origin_to_type) {
221
85.0k
    auto to_type = get_serialized_type(origin_to_type);
222
85.0k
    auto from_type = get_serialized_type(origin_from_type);
223
85.0k
    if (from_type->equals(*to_type)) {
224
131
        return create_identity_wrapper(from_type);
225
131
    }
226
227
    // variant needs to be judged first
228
84.8k
    if (to_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
229
3
        return create_cast_to_variant_wrapper(from_type,
230
3
                                              static_cast<const DataTypeVariant&>(*to_type));
231
3
    }
232
84.8k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
233
10
        return create_cast_from_variant_wrapper(static_cast<const DataTypeVariant&>(*from_type),
234
10
                                                to_type);
235
10
    }
236
237
84.8k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
238
113
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
239
113
                                              to_type,
240
113
                                              context ? context->jsonb_string_as_string() : false);
241
113
    }
242
243
84.7k
    switch (to_type->get_primitive_type()) {
244
32
    case PrimitiveType::TYPE_BOOLEAN:
245
32
        return create_boolean_wrapper(context, from_type);
246
1.42k
    case PrimitiveType::TYPE_TINYINT:
247
1.42k
        return create_int_wrapper<DataTypeInt8>(context, from_type);
248
1.40k
    case PrimitiveType::TYPE_SMALLINT:
249
1.40k
        return create_int_wrapper<DataTypeInt16>(context, from_type);
250
1.26k
    case PrimitiveType::TYPE_INT:
251
1.26k
        return create_int_wrapper<DataTypeInt32>(context, from_type);
252
1.02k
    case PrimitiveType::TYPE_BIGINT:
253
1.02k
        return create_int_wrapper<DataTypeInt64>(context, from_type);
254
1.08k
    case PrimitiveType::TYPE_LARGEINT:
255
1.08k
        return create_int_wrapper<DataTypeInt128>(context, from_type);
256
8.17k
    case PrimitiveType::TYPE_FLOAT:
257
8.17k
        return create_float_wrapper<DataTypeFloat32>(context, from_type);
258
8.22k
    case PrimitiveType::TYPE_DOUBLE:
259
8.22k
        return create_float_wrapper<DataTypeFloat64>(context, from_type);
260
0
    case PrimitiveType::TYPE_DATE:
261
0
        return create_datelike_wrapper<DataTypeDate>(context, from_type);
262
0
    case PrimitiveType::TYPE_DATETIME:
263
0
        return create_datelike_wrapper<DataTypeDateTime>(context, from_type);
264
71
    case PrimitiveType::TYPE_DATEV2:
265
71
        return create_datelike_wrapper<DataTypeDateV2>(context, from_type);
266
72
    case PrimitiveType::TYPE_DATETIMEV2:
267
72
        return create_datelike_wrapper<DataTypeDateTimeV2>(context, from_type);
268
0
    case PrimitiveType::TYPE_TIMESTAMPTZ:
269
0
        return create_timestamptz_wrapper(context, from_type);
270
16
    case PrimitiveType::TYPE_TIMEV2:
271
16
        return create_datelike_wrapper<DataTypeTimeV2>(context, from_type);
272
7
    case PrimitiveType::TYPE_IPV4:
273
7
        return create_ip_wrapper<DataTypeIPv4>(context, from_type);
274
10
    case PrimitiveType::TYPE_IPV6:
275
10
        return create_ip_wrapper<DataTypeIPv6>(context, from_type);
276
4
    case PrimitiveType::TYPE_DECIMALV2:
277
4
        return create_decimal_wrapper<DataTypeDecimalV2>(context, from_type);
278
3.23k
    case PrimitiveType::TYPE_DECIMAL32:
279
3.23k
        return create_decimal_wrapper<DataTypeDecimal32>(context, from_type);
280
3.21k
    case PrimitiveType::TYPE_DECIMAL64:
281
3.21k
        return create_decimal_wrapper<DataTypeDecimal64>(context, from_type);
282
3.01k
    case PrimitiveType::TYPE_DECIMAL128I:
283
3.01k
        return create_decimal_wrapper<DataTypeDecimal128>(context, from_type);
284
2.84k
    case PrimitiveType::TYPE_DECIMAL256:
285
2.84k
        return create_decimal_wrapper<DataTypeDecimal256>(context, from_type);
286
0
    case PrimitiveType::TYPE_CHAR:
287
0
    case PrimitiveType::TYPE_VARCHAR:
288
14
    case PrimitiveType::TYPE_STRING:
289
14
        return create_string_wrapper(from_type);
290
1.44k
    case PrimitiveType::TYPE_ARRAY:
291
1.44k
        return create_array_wrapper(context, from_type,
292
1.44k
                                    static_cast<const DataTypeArray&>(*to_type));
293
2
    case PrimitiveType::TYPE_STRUCT:
294
2
        return create_struct_wrapper(context, from_type,
295
2
                                     static_cast<const DataTypeStruct&>(*to_type));
296
3
    case PrimitiveType::TYPE_MAP:
297
3
        return create_map_wrapper(context, from_type, static_cast<const DataTypeMap&>(*to_type));
298
0
    case PrimitiveType::TYPE_HLL:
299
0
        return create_hll_wrapper(context, from_type, static_cast<const DataTypeHLL&>(*to_type));
300
0
    case PrimitiveType::TYPE_BITMAP:
301
0
        return create_bitmap_wrapper(context, from_type,
302
0
                                     static_cast<const DataTypeBitMap&>(*to_type));
303
48.1k
    case PrimitiveType::TYPE_JSONB:
304
48.1k
        return create_cast_to_jsonb_wrapper(from_type, static_cast<const DataTypeJsonb&>(*to_type),
305
48.1k
                                            context ? context->string_as_jsonb_string() : false);
306
0
    case PrimitiveType::TYPE_VARBINARY:
307
0
        return create_varbinary_wrapper(from_type);
308
0
    default:
309
0
        break;
310
84.7k
    }
311
312
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
313
84.7k
}
314
315
} // namespace CastWrapper
316
317
class PreparedFunctionCast : public PreparedFunctionImpl {
318
public:
319
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
320
83.5k
            : 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
83.5k
                        uint32_t result, size_t input_rows_count) const override {
327
83.5k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
328
83.5k
    }
329
330
83.5k
    bool use_default_implementation_for_nulls() const override { return false; }
331
83.5k
    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
84.2k
            : name(name_),
342
84.2k
              argument_types(std::move(argument_types_)),
343
84.2k
              return_type(std::move(return_type_)) {}
344
345
83.5k
    const DataTypes& get_argument_types() const override { return argument_types; }
346
83.5k
    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
83.5k
                                uint32_t /*result*/) const override {
351
83.5k
        return std::make_shared<PreparedFunctionCast>(
352
83.5k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
353
83.5k
                                                         get_return_type()),
354
83.5k
                name);
355
83.5k
    }
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
84.2k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
372
373
84.2k
    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
84.2k
                               const DataTypePtr& return_type) const override {
384
84.2k
        DataTypes data_types(arguments.size());
385
386
252k
        for (size_t i = 0; i < arguments.size(); ++i) {
387
168k
            data_types[i] = arguments[i].type;
388
168k
        }
389
390
84.2k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
391
84.2k
    }
392
393
84.2k
    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
1
void register_function_cast(SimpleFunctionFactory& factory) {
402
1
    factory.register_function<FunctionBuilderCast>();
403
1
}
404
} // namespace doris