Coverage Report

Created: 2026-07-20 16:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/function/cast/function_cast.cpp
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#include <utility>
19
20
#include "core/data_type/data_type_agg_state.h"
21
#include "core/data_type/data_type_decimal.h"
22
#include "core/data_type/data_type_number.h" // IWYU pragma: keep
23
#include "core/data_type/data_type_quantilestate.h"
24
#include "core/data_type/data_type_variant.h"
25
#include "core/data_type/primitive_type.h"
26
#include "exprs/function/cast/cast_to_array.h"
27
#include "exprs/function/cast/cast_to_jsonb.h"
28
#include "exprs/function/cast/cast_to_map.h"
29
#include "exprs/function/cast/cast_to_struct.h"
30
#include "exprs/function/cast/cast_to_variant.h"
31
#include "exprs/function/cast/cast_wrapper_decls.h"
32
#include "exprs/function/cast/variant_v2/cast_variant_v2.h"
33
#include "exprs/function/simple_function_factory.h"
34
35
namespace doris {
36
37
namespace CastWrapper {
38
39
WrapperType create_hll_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
40
6
                               const DataTypeHLL& to_type) {
41
    /// Conversion from String through parsing.
42
6
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
43
6
        return cast_from_string_to_generic;
44
6
    }
45
46
0
    return CastWrapper::create_unsupport_wrapper("Cast to HLL only support from String type");
47
6
}
48
49
WrapperType create_bitmap_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
50
5
                                  const DataTypeBitMap& to_type) {
51
    /// Conversion from String through parsing.
52
5
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
53
5
        return cast_from_string_to_generic;
54
5
    }
55
56
0
    return CastWrapper::create_unsupport_wrapper("Cast to BitMap only support from String type");
57
5
}
58
59
WrapperType create_quantile_state_wrapper(FunctionContext* context,
60
                                          const DataTypePtr& from_type_untyped,
61
2
                                          const DataTypeQuantileState& to_type) {
62
    /// Conversion from String through parsing.
63
2
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
64
2
        return cast_from_string_to_generic;
65
2
    }
66
67
0
    return CastWrapper::create_unsupport_wrapper(
68
0
            "Cast to QuantileState only support from String type");
69
2
}
70
71
556
WrapperType create_varbinary_wrapper(const DataTypePtr& from_type_untyped) {
72
    /// Conversion from String through parsing.
73
556
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
74
556
        return cast_from_string_to_generic;
75
556
    }
76
77
0
    return CastWrapper::create_unsupport_wrapper("Cast to Varbinary only support from String type");
78
556
}
79
80
WrapperType prepare_unpack_dictionaries(FunctionContext* context, const DataTypePtr& from_type,
81
1.70M
                                        const DataTypePtr& to_type) {
82
1.70M
    const auto& from_nested = from_type;
83
1.70M
    const auto& to_nested = to_type;
84
85
1.70M
    if (from_type->is_null_literal()) {
86
2.17k
        if (!to_nested->is_nullable()) {
87
0
            return CastWrapper::create_unsupport_wrapper(
88
0
                    "Cannot convert NULL to a non-nullable type");
89
0
        }
90
91
2.17k
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
92
2.17k
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
93
            /// TODO: remove this in the future.
94
2.17k
            auto& res = block.get_by_position(result);
95
2.17k
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
96
2.17k
                                 ->convert_to_full_column_if_const();
97
2.17k
            return Status::OK();
98
2.17k
        };
99
2.17k
    }
100
101
1.70M
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
102
103
1.70M
    return wrapper;
104
1.70M
}
105
106
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
107
1.66M
                                       const DataTypePtr& to_type) {
108
1.66M
    if (from_type->equals(*to_type)) {
109
91.6k
        return false;
110
91.6k
    }
111
112
1.57M
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
1.32M
        using Types = std::decay_t<decltype(types)>;
114
1.32M
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
373k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
373k
            return false;
120
373k
        }
121
0
        return call_on_index_and_data_type<
122
1.32M
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
930k
            using Types2 = std::decay_t<decltype(types2)>;
124
930k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
679k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
679k
                return false;
129
679k
            }
130
246k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
246k
                using FromFieldType = typename FromDataType::FieldType;
132
246k
                using ToFieldType = typename ToDataType::FieldType;
133
246k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
246k
                UInt32 from_scale = 0;
135
136
246k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
44.4k
                    const auto* from_decimal_type =
138
44.4k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
44.4k
                    from_precision =
140
44.4k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
44.4k
                    from_scale = from_decimal_type->get_scale();
142
44.4k
                }
143
144
246k
                UInt32 to_max_digits = 0;
145
246k
                UInt32 to_precision = 0;
146
246k
                UInt32 to_scale = 0;
147
148
246k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
240k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
240k
                    const auto* to_decimal_type =
152
240k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
240k
                    to_precision = to_decimal_type->get_precision();
154
240k
                    ToDataType::check_type_precision(to_precision);
155
156
240k
                    to_scale = to_decimal_type->get_scale();
157
240k
                    ToDataType::check_type_scale(to_scale);
158
240k
                }
159
246k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
6.15k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
6.15k
                    to_precision = to_max_digits;
162
6.15k
                }
163
164
246k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
246k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
246k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
246k
                if (to_scale > from_scale) {
169
12.3k
                    multiply_may_overflow &=
170
12.3k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
12.3k
                }
172
246k
                return narrow_integral || multiply_may_overflow;
173
246k
            }
174
0
            return false;
175
930k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
20
            using Types2 = std::decay_t<decltype(types2)>;
124
20
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
20
            return false;
175
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
122
17
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
17
            using Types2 = std::decay_t<decltype(types2)>;
124
17
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
17
            return false;
175
17
        });
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
122
32
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
32
            using Types2 = std::decay_t<decltype(types2)>;
124
32
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
32
            return false;
175
32
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
122
93
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
93
            using Types2 = std::decay_t<decltype(types2)>;
124
93
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
93
            return false;
175
93
        });
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
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
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
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
122
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
10
            using Types2 = std::decay_t<decltype(types2)>;
124
10
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
10
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
10
                using FromFieldType = typename FromDataType::FieldType;
132
10
                using ToFieldType = typename ToDataType::FieldType;
133
10
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
10
                UInt32 from_scale = 0;
135
136
10
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
10
                    const auto* from_decimal_type =
138
10
                            check_and_get_data_type<FromDataType>(from_type.get());
139
10
                    from_precision =
140
10
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
10
                    from_scale = from_decimal_type->get_scale();
142
10
                }
143
144
10
                UInt32 to_max_digits = 0;
145
10
                UInt32 to_precision = 0;
146
10
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
10
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
10
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
10
                    to_precision = to_max_digits;
162
10
                }
163
164
10
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
10
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
10
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
10
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
10
                return narrow_integral || multiply_may_overflow;
173
10
            }
174
0
            return false;
175
10
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
122
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
5
            using Types2 = std::decay_t<decltype(types2)>;
124
5
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
5
                using FromFieldType = typename FromDataType::FieldType;
132
5
                using ToFieldType = typename ToDataType::FieldType;
133
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
5
                UInt32 from_scale = 0;
135
136
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
5
                    const auto* from_decimal_type =
138
5
                            check_and_get_data_type<FromDataType>(from_type.get());
139
5
                    from_precision =
140
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
5
                    from_scale = from_decimal_type->get_scale();
142
5
                }
143
144
5
                UInt32 to_max_digits = 0;
145
5
                UInt32 to_precision = 0;
146
5
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
5
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
5
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
5
                    to_precision = to_max_digits;
162
5
                }
163
164
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
5
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
5
                return narrow_integral || multiply_may_overflow;
173
5
            }
174
0
            return false;
175
5
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2
                using FromFieldType = typename FromDataType::FieldType;
132
2
                using ToFieldType = typename ToDataType::FieldType;
133
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2
                UInt32 from_scale = 0;
135
136
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
2
                    const auto* from_decimal_type =
138
2
                            check_and_get_data_type<FromDataType>(from_type.get());
139
2
                    from_precision =
140
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
2
                    from_scale = from_decimal_type->get_scale();
142
2
                }
143
144
2
                UInt32 to_max_digits = 0;
145
2
                UInt32 to_precision = 0;
146
2
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
2
                    to_precision = to_max_digits;
162
2
                }
163
164
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
2
                return narrow_integral || multiply_may_overflow;
173
2
            }
174
0
            return false;
175
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
122
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
5
            using Types2 = std::decay_t<decltype(types2)>;
124
5
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
5
                using FromFieldType = typename FromDataType::FieldType;
132
5
                using ToFieldType = typename ToDataType::FieldType;
133
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
5
                UInt32 from_scale = 0;
135
136
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
5
                    const auto* from_decimal_type =
138
5
                            check_and_get_data_type<FromDataType>(from_type.get());
139
5
                    from_precision =
140
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
5
                    from_scale = from_decimal_type->get_scale();
142
5
                }
143
144
5
                UInt32 to_max_digits = 0;
145
5
                UInt32 to_precision = 0;
146
5
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
5
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
5
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
5
                    to_precision = to_max_digits;
162
5
                }
163
164
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
5
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
5
                return narrow_integral || multiply_may_overflow;
173
5
            }
174
0
            return false;
175
5
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2
                using FromFieldType = typename FromDataType::FieldType;
132
2
                using ToFieldType = typename ToDataType::FieldType;
133
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2
                UInt32 from_scale = 0;
135
136
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
2
                    const auto* from_decimal_type =
138
2
                            check_and_get_data_type<FromDataType>(from_type.get());
139
2
                    from_precision =
140
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
2
                    from_scale = from_decimal_type->get_scale();
142
2
                }
143
144
2
                UInt32 to_max_digits = 0;
145
2
                UInt32 to_precision = 0;
146
2
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
2
                    to_precision = to_max_digits;
162
2
                }
163
164
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
2
                return narrow_integral || multiply_may_overflow;
173
2
            }
174
0
            return false;
175
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
122
821
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
821
            using Types2 = std::decay_t<decltype(types2)>;
124
821
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
821
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
821
                return false;
129
821
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
821
            return false;
175
821
        });
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
122
2.40k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2.40k
            using Types2 = std::decay_t<decltype(types2)>;
124
2.40k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2.40k
            return false;
175
2.40k
        });
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
122
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
10
            using Types2 = std::decay_t<decltype(types2)>;
124
10
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
10
            return false;
175
10
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
122
143
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
143
            using Types2 = std::decay_t<decltype(types2)>;
124
143
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
143
            return false;
175
143
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
122
259
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
259
            using Types2 = std::decay_t<decltype(types2)>;
124
259
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
259
            return false;
175
259
        });
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
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
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
122
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
23
            using Types2 = std::decay_t<decltype(types2)>;
124
23
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
23
            return false;
175
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
122
30
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
30
            using Types2 = std::decay_t<decltype(types2)>;
124
30
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
30
            return false;
175
30
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
122
19
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
19
            using Types2 = std::decay_t<decltype(types2)>;
124
19
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
19
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
19
                using FromFieldType = typename FromDataType::FieldType;
132
19
                using ToFieldType = typename ToDataType::FieldType;
133
19
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
19
                UInt32 from_scale = 0;
135
136
19
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
19
                    const auto* from_decimal_type =
138
19
                            check_and_get_data_type<FromDataType>(from_type.get());
139
19
                    from_precision =
140
19
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
19
                    from_scale = from_decimal_type->get_scale();
142
19
                }
143
144
19
                UInt32 to_max_digits = 0;
145
19
                UInt32 to_precision = 0;
146
19
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
19
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
19
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
19
                    to_precision = to_max_digits;
162
19
                }
163
164
19
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
19
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
19
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
19
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
19
                return narrow_integral || multiply_may_overflow;
173
19
            }
174
0
            return false;
175
19
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
122
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
24
            using Types2 = std::decay_t<decltype(types2)>;
124
24
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
24
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
24
                using FromFieldType = typename FromDataType::FieldType;
132
24
                using ToFieldType = typename ToDataType::FieldType;
133
24
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
24
                UInt32 from_scale = 0;
135
136
24
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
24
                    const auto* from_decimal_type =
138
24
                            check_and_get_data_type<FromDataType>(from_type.get());
139
24
                    from_precision =
140
24
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
24
                    from_scale = from_decimal_type->get_scale();
142
24
                }
143
144
24
                UInt32 to_max_digits = 0;
145
24
                UInt32 to_precision = 0;
146
24
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
24
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
24
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
24
                    to_precision = to_max_digits;
162
24
                }
163
164
24
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
24
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
24
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
24
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
24
                return narrow_integral || multiply_may_overflow;
173
24
            }
174
0
            return false;
175
24
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
8
                using FromFieldType = typename FromDataType::FieldType;
132
8
                using ToFieldType = typename ToDataType::FieldType;
133
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
8
                UInt32 from_scale = 0;
135
136
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
8
                    const auto* from_decimal_type =
138
8
                            check_and_get_data_type<FromDataType>(from_type.get());
139
8
                    from_precision =
140
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
8
                    from_scale = from_decimal_type->get_scale();
142
8
                }
143
144
8
                UInt32 to_max_digits = 0;
145
8
                UInt32 to_precision = 0;
146
8
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
8
                    to_precision = to_max_digits;
162
8
                }
163
164
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
8
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
8
                return narrow_integral || multiply_may_overflow;
173
8
            }
174
0
            return false;
175
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
122
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
24
            using Types2 = std::decay_t<decltype(types2)>;
124
24
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
24
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
24
                using FromFieldType = typename FromDataType::FieldType;
132
24
                using ToFieldType = typename ToDataType::FieldType;
133
24
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
24
                UInt32 from_scale = 0;
135
136
24
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
24
                    const auto* from_decimal_type =
138
24
                            check_and_get_data_type<FromDataType>(from_type.get());
139
24
                    from_precision =
140
24
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
24
                    from_scale = from_decimal_type->get_scale();
142
24
                }
143
144
24
                UInt32 to_max_digits = 0;
145
24
                UInt32 to_precision = 0;
146
24
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
24
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
24
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
24
                    to_precision = to_max_digits;
162
24
                }
163
164
24
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
24
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
24
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
24
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
24
                return narrow_integral || multiply_may_overflow;
173
24
            }
174
0
            return false;
175
24
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
122
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
24
            using Types2 = std::decay_t<decltype(types2)>;
124
24
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
24
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
24
                using FromFieldType = typename FromDataType::FieldType;
132
24
                using ToFieldType = typename ToDataType::FieldType;
133
24
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
24
                UInt32 from_scale = 0;
135
136
24
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
24
                    const auto* from_decimal_type =
138
24
                            check_and_get_data_type<FromDataType>(from_type.get());
139
24
                    from_precision =
140
24
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
24
                    from_scale = from_decimal_type->get_scale();
142
24
                }
143
144
24
                UInt32 to_max_digits = 0;
145
24
                UInt32 to_precision = 0;
146
24
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
24
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
24
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
24
                    to_precision = to_max_digits;
162
24
                }
163
164
24
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
24
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
24
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
24
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
24
                return narrow_integral || multiply_may_overflow;
173
24
            }
174
0
            return false;
175
24
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
122
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
72
            using Types2 = std::decay_t<decltype(types2)>;
124
72
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
72
            return false;
175
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
122
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
24
            using Types2 = std::decay_t<decltype(types2)>;
124
24
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
24
            return false;
175
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
122
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
320
            using Types2 = std::decay_t<decltype(types2)>;
124
320
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
320
            return false;
175
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
122
6.76k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
6.76k
            using Types2 = std::decay_t<decltype(types2)>;
124
6.76k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
6.76k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
6.76k
                return false;
129
6.76k
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
6.76k
            return false;
175
6.76k
        });
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
122
146
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
146
            using Types2 = std::decay_t<decltype(types2)>;
124
146
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
146
            return false;
175
146
        });
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
122
1.51k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.51k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.51k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1.51k
            return false;
175
1.51k
        });
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
122
129
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
129
            using Types2 = std::decay_t<decltype(types2)>;
124
129
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
129
            return false;
175
129
        });
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
122
100
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
100
            using Types2 = std::decay_t<decltype(types2)>;
124
100
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
100
            return false;
175
100
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
122
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
20
            using Types2 = std::decay_t<decltype(types2)>;
124
20
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
20
            return false;
175
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
21
            using Types2 = std::decay_t<decltype(types2)>;
124
21
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
21
            return false;
175
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
122
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
25
            using Types2 = std::decay_t<decltype(types2)>;
124
25
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
25
            return false;
175
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
122
22
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
22
            using Types2 = std::decay_t<decltype(types2)>;
124
22
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
22
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
22
                using FromFieldType = typename FromDataType::FieldType;
132
22
                using ToFieldType = typename ToDataType::FieldType;
133
22
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
22
                UInt32 from_scale = 0;
135
136
22
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
22
                    const auto* from_decimal_type =
138
22
                            check_and_get_data_type<FromDataType>(from_type.get());
139
22
                    from_precision =
140
22
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
22
                    from_scale = from_decimal_type->get_scale();
142
22
                }
143
144
22
                UInt32 to_max_digits = 0;
145
22
                UInt32 to_precision = 0;
146
22
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
22
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
22
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
22
                    to_precision = to_max_digits;
162
22
                }
163
164
22
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
22
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
22
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
22
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
22
                return narrow_integral || multiply_may_overflow;
173
22
            }
174
0
            return false;
175
22
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
122
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
24
            using Types2 = std::decay_t<decltype(types2)>;
124
24
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
24
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
24
                using FromFieldType = typename FromDataType::FieldType;
132
24
                using ToFieldType = typename ToDataType::FieldType;
133
24
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
24
                UInt32 from_scale = 0;
135
136
24
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
24
                    const auto* from_decimal_type =
138
24
                            check_and_get_data_type<FromDataType>(from_type.get());
139
24
                    from_precision =
140
24
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
24
                    from_scale = from_decimal_type->get_scale();
142
24
                }
143
144
24
                UInt32 to_max_digits = 0;
145
24
                UInt32 to_precision = 0;
146
24
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
24
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
24
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
24
                    to_precision = to_max_digits;
162
24
                }
163
164
24
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
24
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
24
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
24
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
24
                return narrow_integral || multiply_may_overflow;
173
24
            }
174
0
            return false;
175
24
        });
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
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
8
                using FromFieldType = typename FromDataType::FieldType;
132
8
                using ToFieldType = typename ToDataType::FieldType;
133
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
8
                UInt32 from_scale = 0;
135
136
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
8
                    const auto* from_decimal_type =
138
8
                            check_and_get_data_type<FromDataType>(from_type.get());
139
8
                    from_precision =
140
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
8
                    from_scale = from_decimal_type->get_scale();
142
8
                }
143
144
8
                UInt32 to_max_digits = 0;
145
8
                UInt32 to_precision = 0;
146
8
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
8
                    to_precision = to_max_digits;
162
8
                }
163
164
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
8
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
8
                return narrow_integral || multiply_may_overflow;
173
8
            }
174
0
            return false;
175
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
122
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
25
            using Types2 = std::decay_t<decltype(types2)>;
124
25
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
25
                using FromFieldType = typename FromDataType::FieldType;
132
25
                using ToFieldType = typename ToDataType::FieldType;
133
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
25
                UInt32 from_scale = 0;
135
136
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
25
                    const auto* from_decimal_type =
138
25
                            check_and_get_data_type<FromDataType>(from_type.get());
139
25
                    from_precision =
140
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
25
                    from_scale = from_decimal_type->get_scale();
142
25
                }
143
144
25
                UInt32 to_max_digits = 0;
145
25
                UInt32 to_precision = 0;
146
25
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
25
                    to_precision = to_max_digits;
162
25
                }
163
164
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
25
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
25
                return narrow_integral || multiply_may_overflow;
173
25
            }
174
0
            return false;
175
25
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
122
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
25
            using Types2 = std::decay_t<decltype(types2)>;
124
25
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
25
                using FromFieldType = typename FromDataType::FieldType;
132
25
                using ToFieldType = typename ToDataType::FieldType;
133
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
25
                UInt32 from_scale = 0;
135
136
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
25
                    const auto* from_decimal_type =
138
25
                            check_and_get_data_type<FromDataType>(from_type.get());
139
25
                    from_precision =
140
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
25
                    from_scale = from_decimal_type->get_scale();
142
25
                }
143
144
25
                UInt32 to_max_digits = 0;
145
25
                UInt32 to_precision = 0;
146
25
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
25
                    to_precision = to_max_digits;
162
25
                }
163
164
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
25
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
25
                return narrow_integral || multiply_may_overflow;
173
25
            }
174
0
            return false;
175
25
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
122
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
72
            using Types2 = std::decay_t<decltype(types2)>;
124
72
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
72
            return false;
175
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
122
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
24
            using Types2 = std::decay_t<decltype(types2)>;
124
24
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
24
            return false;
175
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
122
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
320
            using Types2 = std::decay_t<decltype(types2)>;
124
320
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
320
            return false;
175
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
122
2.91k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2.91k
            using Types2 = std::decay_t<decltype(types2)>;
124
2.91k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
2.91k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
2.91k
                return false;
129
2.91k
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2.91k
            return false;
175
2.91k
        });
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
122
44
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
44
            using Types2 = std::decay_t<decltype(types2)>;
124
44
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
44
            return false;
175
44
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
3.63k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
3.63k
            using Types2 = std::decay_t<decltype(types2)>;
124
3.63k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
3.63k
            return false;
175
3.63k
        });
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
122
491
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
491
            using Types2 = std::decay_t<decltype(types2)>;
124
491
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
491
            return false;
175
491
        });
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
122
137k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
137k
            using Types2 = std::decay_t<decltype(types2)>;
124
137k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
137k
            return false;
175
137k
        });
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
122
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
13
            using Types2 = std::decay_t<decltype(types2)>;
124
13
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
13
            return false;
175
13
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
20
            using Types2 = std::decay_t<decltype(types2)>;
124
20
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
20
            return false;
175
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
133
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
133
            using Types2 = std::decay_t<decltype(types2)>;
124
133
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
133
            return false;
175
133
        });
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
122
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
21
            using Types2 = std::decay_t<decltype(types2)>;
124
21
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
21
                using FromFieldType = typename FromDataType::FieldType;
132
21
                using ToFieldType = typename ToDataType::FieldType;
133
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
21
                UInt32 from_scale = 0;
135
136
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
21
                    const auto* from_decimal_type =
138
21
                            check_and_get_data_type<FromDataType>(from_type.get());
139
21
                    from_precision =
140
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
21
                    from_scale = from_decimal_type->get_scale();
142
21
                }
143
144
21
                UInt32 to_max_digits = 0;
145
21
                UInt32 to_precision = 0;
146
21
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
21
                    to_precision = to_max_digits;
162
21
                }
163
164
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
21
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
21
                return narrow_integral || multiply_may_overflow;
173
21
            }
174
0
            return false;
175
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
122
37
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
37
            using Types2 = std::decay_t<decltype(types2)>;
124
37
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
37
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
37
                using FromFieldType = typename FromDataType::FieldType;
132
37
                using ToFieldType = typename ToDataType::FieldType;
133
37
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
37
                UInt32 from_scale = 0;
135
136
37
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
37
                    const auto* from_decimal_type =
138
37
                            check_and_get_data_type<FromDataType>(from_type.get());
139
37
                    from_precision =
140
37
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
37
                    from_scale = from_decimal_type->get_scale();
142
37
                }
143
144
37
                UInt32 to_max_digits = 0;
145
37
                UInt32 to_precision = 0;
146
37
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
37
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
37
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
37
                    to_precision = to_max_digits;
162
37
                }
163
164
37
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
37
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
37
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
37
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
37
                return narrow_integral || multiply_may_overflow;
173
37
            }
174
0
            return false;
175
37
        });
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
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
8
                using FromFieldType = typename FromDataType::FieldType;
132
8
                using ToFieldType = typename ToDataType::FieldType;
133
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
8
                UInt32 from_scale = 0;
135
136
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
8
                    const auto* from_decimal_type =
138
8
                            check_and_get_data_type<FromDataType>(from_type.get());
139
8
                    from_precision =
140
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
8
                    from_scale = from_decimal_type->get_scale();
142
8
                }
143
144
8
                UInt32 to_max_digits = 0;
145
8
                UInt32 to_precision = 0;
146
8
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
8
                    to_precision = to_max_digits;
162
8
                }
163
164
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
8
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
8
                return narrow_integral || multiply_may_overflow;
173
8
            }
174
0
            return false;
175
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
122
249
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
249
            using Types2 = std::decay_t<decltype(types2)>;
124
249
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
249
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
249
                using FromFieldType = typename FromDataType::FieldType;
132
249
                using ToFieldType = typename ToDataType::FieldType;
133
249
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
249
                UInt32 from_scale = 0;
135
136
249
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
249
                    const auto* from_decimal_type =
138
249
                            check_and_get_data_type<FromDataType>(from_type.get());
139
249
                    from_precision =
140
249
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
249
                    from_scale = from_decimal_type->get_scale();
142
249
                }
143
144
249
                UInt32 to_max_digits = 0;
145
249
                UInt32 to_precision = 0;
146
249
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
249
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
249
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
249
                    to_precision = to_max_digits;
162
249
                }
163
164
249
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
249
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
249
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
249
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
249
                return narrow_integral || multiply_may_overflow;
173
249
            }
174
0
            return false;
175
249
        });
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
122
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
21
            using Types2 = std::decay_t<decltype(types2)>;
124
21
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
21
                using FromFieldType = typename FromDataType::FieldType;
132
21
                using ToFieldType = typename ToDataType::FieldType;
133
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
21
                UInt32 from_scale = 0;
135
136
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
21
                    const auto* from_decimal_type =
138
21
                            check_and_get_data_type<FromDataType>(from_type.get());
139
21
                    from_precision =
140
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
21
                    from_scale = from_decimal_type->get_scale();
142
21
                }
143
144
21
                UInt32 to_max_digits = 0;
145
21
                UInt32 to_precision = 0;
146
21
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
21
                    to_precision = to_max_digits;
162
21
                }
163
164
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
21
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
21
                return narrow_integral || multiply_may_overflow;
173
21
            }
174
0
            return false;
175
21
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
122
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
12
            using Types2 = std::decay_t<decltype(types2)>;
124
12
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
12
            return false;
175
12
        });
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
122
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
24
            using Types2 = std::decay_t<decltype(types2)>;
124
24
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
24
            return false;
175
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
122
276
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
276
            using Types2 = std::decay_t<decltype(types2)>;
124
276
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
276
            return false;
175
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
122
23.3k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
23.3k
            using Types2 = std::decay_t<decltype(types2)>;
124
23.3k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
23.3k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
23.3k
                return false;
129
23.3k
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
23.3k
            return false;
175
23.3k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
122
576
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
576
            using Types2 = std::decay_t<decltype(types2)>;
124
576
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
576
            return false;
175
576
        });
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
122
1.36k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.36k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.36k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1.36k
            return false;
175
1.36k
        });
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
122
665
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
665
            using Types2 = std::decay_t<decltype(types2)>;
124
665
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
665
            return false;
175
665
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
122
13.8k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
13.8k
            using Types2 = std::decay_t<decltype(types2)>;
124
13.8k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
13.8k
            return false;
175
13.8k
        });
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
122
315
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
315
            using Types2 = std::decay_t<decltype(types2)>;
124
315
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
315
            return false;
175
315
        });
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
122
642
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
642
            using Types2 = std::decay_t<decltype(types2)>;
124
642
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
642
            return false;
175
642
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
2.34k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2.34k
            using Types2 = std::decay_t<decltype(types2)>;
124
2.34k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2.34k
            return false;
175
2.34k
        });
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
122
312
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
312
            using Types2 = std::decay_t<decltype(types2)>;
124
312
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
312
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
312
                using FromFieldType = typename FromDataType::FieldType;
132
312
                using ToFieldType = typename ToDataType::FieldType;
133
312
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
312
                UInt32 from_scale = 0;
135
136
312
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
312
                    const auto* from_decimal_type =
138
312
                            check_and_get_data_type<FromDataType>(from_type.get());
139
312
                    from_precision =
140
312
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
312
                    from_scale = from_decimal_type->get_scale();
142
312
                }
143
144
312
                UInt32 to_max_digits = 0;
145
312
                UInt32 to_precision = 0;
146
312
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
312
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
312
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
312
                    to_precision = to_max_digits;
162
312
                }
163
164
312
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
312
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
312
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
312
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
312
                return narrow_integral || multiply_may_overflow;
173
312
            }
174
0
            return false;
175
312
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
122
318
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
318
            using Types2 = std::decay_t<decltype(types2)>;
124
318
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
318
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
318
                using FromFieldType = typename FromDataType::FieldType;
132
318
                using ToFieldType = typename ToDataType::FieldType;
133
318
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
318
                UInt32 from_scale = 0;
135
136
318
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
318
                    const auto* from_decimal_type =
138
318
                            check_and_get_data_type<FromDataType>(from_type.get());
139
318
                    from_precision =
140
318
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
318
                    from_scale = from_decimal_type->get_scale();
142
318
                }
143
144
318
                UInt32 to_max_digits = 0;
145
318
                UInt32 to_precision = 0;
146
318
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
318
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
318
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
318
                    to_precision = to_max_digits;
162
318
                }
163
164
318
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
318
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
318
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
318
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
318
                return narrow_integral || multiply_may_overflow;
173
318
            }
174
0
            return false;
175
318
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
303
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
303
            using Types2 = std::decay_t<decltype(types2)>;
124
303
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
303
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
303
                using FromFieldType = typename FromDataType::FieldType;
132
303
                using ToFieldType = typename ToDataType::FieldType;
133
303
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
303
                UInt32 from_scale = 0;
135
136
303
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
303
                    const auto* from_decimal_type =
138
303
                            check_and_get_data_type<FromDataType>(from_type.get());
139
303
                    from_precision =
140
303
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
303
                    from_scale = from_decimal_type->get_scale();
142
303
                }
143
144
303
                UInt32 to_max_digits = 0;
145
303
                UInt32 to_precision = 0;
146
303
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
303
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
303
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
303
                    to_precision = to_max_digits;
162
303
                }
163
164
303
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
303
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
303
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
303
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
303
                return narrow_integral || multiply_may_overflow;
173
303
            }
174
0
            return false;
175
303
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
122
746
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
746
            using Types2 = std::decay_t<decltype(types2)>;
124
746
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
746
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
746
                using FromFieldType = typename FromDataType::FieldType;
132
746
                using ToFieldType = typename ToDataType::FieldType;
133
746
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
746
                UInt32 from_scale = 0;
135
136
746
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
746
                    const auto* from_decimal_type =
138
746
                            check_and_get_data_type<FromDataType>(from_type.get());
139
746
                    from_precision =
140
746
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
746
                    from_scale = from_decimal_type->get_scale();
142
746
                }
143
144
746
                UInt32 to_max_digits = 0;
145
746
                UInt32 to_precision = 0;
146
746
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
746
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
746
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
746
                    to_precision = to_max_digits;
162
746
                }
163
164
746
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
746
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
746
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
746
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
746
                return narrow_integral || multiply_may_overflow;
173
746
            }
174
0
            return false;
175
746
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
122
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
21
            using Types2 = std::decay_t<decltype(types2)>;
124
21
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
21
                using FromFieldType = typename FromDataType::FieldType;
132
21
                using ToFieldType = typename ToDataType::FieldType;
133
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
21
                UInt32 from_scale = 0;
135
136
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
21
                    const auto* from_decimal_type =
138
21
                            check_and_get_data_type<FromDataType>(from_type.get());
139
21
                    from_precision =
140
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
21
                    from_scale = from_decimal_type->get_scale();
142
21
                }
143
144
21
                UInt32 to_max_digits = 0;
145
21
                UInt32 to_precision = 0;
146
21
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
21
                    to_precision = to_max_digits;
162
21
                }
163
164
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
21
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
21
                return narrow_integral || multiply_may_overflow;
173
21
            }
174
0
            return false;
175
21
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
122
1.25k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.25k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.25k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1.25k
            return false;
175
1.25k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
122
1.25k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.25k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.25k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1.25k
            return false;
175
1.25k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
122
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
4
            using Types2 = std::decay_t<decltype(types2)>;
124
4
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
4
            return false;
175
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
122
23.1k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
23.1k
            using Types2 = std::decay_t<decltype(types2)>;
124
23.1k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
23.1k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
23.1k
                return false;
129
23.1k
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
23.1k
            return false;
175
23.1k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
122
127
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
127
            using Types2 = std::decay_t<decltype(types2)>;
124
127
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
127
            return false;
175
127
        });
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
122
109
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
109
            using Types2 = std::decay_t<decltype(types2)>;
124
109
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
109
            return false;
175
109
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
122
79
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
79
            using Types2 = std::decay_t<decltype(types2)>;
124
79
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
79
            return false;
175
79
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
122
135
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
135
            using Types2 = std::decay_t<decltype(types2)>;
124
135
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
135
            return false;
175
135
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
122
575
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
575
            using Types2 = std::decay_t<decltype(types2)>;
124
575
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
575
            return false;
175
575
        });
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
122
9
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
9
            using Types2 = std::decay_t<decltype(types2)>;
124
9
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
9
            return false;
175
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
122
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
13
            using Types2 = std::decay_t<decltype(types2)>;
124
13
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
13
            return false;
175
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
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
122
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
21
            using Types2 = std::decay_t<decltype(types2)>;
124
21
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
21
                using FromFieldType = typename FromDataType::FieldType;
132
21
                using ToFieldType = typename ToDataType::FieldType;
133
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
21
                UInt32 from_scale = 0;
135
136
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
21
                    const auto* from_decimal_type =
138
21
                            check_and_get_data_type<FromDataType>(from_type.get());
139
21
                    from_precision =
140
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
21
                    from_scale = from_decimal_type->get_scale();
142
21
                }
143
144
21
                UInt32 to_max_digits = 0;
145
21
                UInt32 to_precision = 0;
146
21
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
21
                    to_precision = to_max_digits;
162
21
                }
163
164
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
21
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
21
                return narrow_integral || multiply_may_overflow;
173
21
            }
174
0
            return false;
175
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
8
                using FromFieldType = typename FromDataType::FieldType;
132
8
                using ToFieldType = typename ToDataType::FieldType;
133
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
8
                UInt32 from_scale = 0;
135
136
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
8
                    const auto* from_decimal_type =
138
8
                            check_and_get_data_type<FromDataType>(from_type.get());
139
8
                    from_precision =
140
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
8
                    from_scale = from_decimal_type->get_scale();
142
8
                }
143
144
8
                UInt32 to_max_digits = 0;
145
8
                UInt32 to_precision = 0;
146
8
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
8
                    to_precision = to_max_digits;
162
8
                }
163
164
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
8
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
8
                return narrow_integral || multiply_may_overflow;
173
8
            }
174
0
            return false;
175
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
122
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
21
            using Types2 = std::decay_t<decltype(types2)>;
124
21
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
21
                using FromFieldType = typename FromDataType::FieldType;
132
21
                using ToFieldType = typename ToDataType::FieldType;
133
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
21
                UInt32 from_scale = 0;
135
136
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
21
                    const auto* from_decimal_type =
138
21
                            check_and_get_data_type<FromDataType>(from_type.get());
139
21
                    from_precision =
140
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
21
                    from_scale = from_decimal_type->get_scale();
142
21
                }
143
144
21
                UInt32 to_max_digits = 0;
145
21
                UInt32 to_precision = 0;
146
21
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
21
                    to_precision = to_max_digits;
162
21
                }
163
164
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
21
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
21
                return narrow_integral || multiply_may_overflow;
173
21
            }
174
0
            return false;
175
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
122
782
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
782
            using Types2 = std::decay_t<decltype(types2)>;
124
782
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
782
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
782
                using FromFieldType = typename FromDataType::FieldType;
132
782
                using ToFieldType = typename ToDataType::FieldType;
133
782
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
782
                UInt32 from_scale = 0;
135
136
782
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
782
                    const auto* from_decimal_type =
138
782
                            check_and_get_data_type<FromDataType>(from_type.get());
139
782
                    from_precision =
140
782
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
782
                    from_scale = from_decimal_type->get_scale();
142
782
                }
143
144
782
                UInt32 to_max_digits = 0;
145
782
                UInt32 to_precision = 0;
146
782
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
782
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
782
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
782
                    to_precision = to_max_digits;
162
782
                }
163
164
782
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
782
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
782
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
782
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
782
                return narrow_integral || multiply_may_overflow;
173
782
            }
174
0
            return false;
175
782
        });
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
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
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
122
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
16
            using Types2 = std::decay_t<decltype(types2)>;
124
16
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
16
            return false;
175
16
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
122
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
4
            using Types2 = std::decay_t<decltype(types2)>;
124
4
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
4
            return false;
175
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
122
77.3k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
77.3k
            using Types2 = std::decay_t<decltype(types2)>;
124
77.3k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
77.3k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
77.3k
                return false;
129
77.3k
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
77.3k
            return false;
175
77.3k
        });
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
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
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
122
31
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
31
            using Types2 = std::decay_t<decltype(types2)>;
124
31
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
31
            return false;
175
31
        });
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
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
8
            return false;
175
8
        });
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
122
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
20
            using Types2 = std::decay_t<decltype(types2)>;
124
20
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
20
            return false;
175
20
        });
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
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
8
            return false;
175
8
        });
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
122
119
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
119
            using Types2 = std::decay_t<decltype(types2)>;
124
119
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
119
            return false;
175
119
        });
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
122
88
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
88
            using Types2 = std::decay_t<decltype(types2)>;
124
88
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
88
            return false;
175
88
        });
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
122
119
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
119
            using Types2 = std::decay_t<decltype(types2)>;
124
119
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
119
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
119
                using FromFieldType = typename FromDataType::FieldType;
132
119
                using ToFieldType = typename ToDataType::FieldType;
133
119
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
119
                UInt32 from_scale = 0;
135
136
119
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
119
                    const auto* from_decimal_type =
138
119
                            check_and_get_data_type<FromDataType>(from_type.get());
139
119
                    from_precision =
140
119
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
119
                    from_scale = from_decimal_type->get_scale();
142
119
                }
143
144
119
                UInt32 to_max_digits = 0;
145
119
                UInt32 to_precision = 0;
146
119
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
119
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
119
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
119
                    to_precision = to_max_digits;
162
119
                }
163
164
119
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
119
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
119
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
119
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
119
                return narrow_integral || multiply_may_overflow;
173
119
            }
174
0
            return false;
175
119
        });
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
122
112
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
112
            using Types2 = std::decay_t<decltype(types2)>;
124
112
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
112
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
112
                using FromFieldType = typename FromDataType::FieldType;
132
112
                using ToFieldType = typename ToDataType::FieldType;
133
112
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
112
                UInt32 from_scale = 0;
135
136
112
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
112
                    const auto* from_decimal_type =
138
112
                            check_and_get_data_type<FromDataType>(from_type.get());
139
112
                    from_precision =
140
112
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
112
                    from_scale = from_decimal_type->get_scale();
142
112
                }
143
144
112
                UInt32 to_max_digits = 0;
145
112
                UInt32 to_precision = 0;
146
112
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
112
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
112
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
112
                    to_precision = to_max_digits;
162
112
                }
163
164
112
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
112
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
112
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
112
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
112
                return narrow_integral || multiply_may_overflow;
173
112
            }
174
0
            return false;
175
112
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
16
            using Types2 = std::decay_t<decltype(types2)>;
124
16
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
16
                using FromFieldType = typename FromDataType::FieldType;
132
16
                using ToFieldType = typename ToDataType::FieldType;
133
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
16
                UInt32 from_scale = 0;
135
136
16
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
16
                    const auto* from_decimal_type =
138
16
                            check_and_get_data_type<FromDataType>(from_type.get());
139
16
                    from_precision =
140
16
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
16
                    from_scale = from_decimal_type->get_scale();
142
16
                }
143
144
16
                UInt32 to_max_digits = 0;
145
16
                UInt32 to_precision = 0;
146
16
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
16
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
16
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
16
                    to_precision = to_max_digits;
162
16
                }
163
164
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
16
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
16
                return narrow_integral || multiply_may_overflow;
173
16
            }
174
0
            return false;
175
16
        });
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
122
97
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
97
            using Types2 = std::decay_t<decltype(types2)>;
124
97
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
97
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
97
                using FromFieldType = typename FromDataType::FieldType;
132
97
                using ToFieldType = typename ToDataType::FieldType;
133
97
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
97
                UInt32 from_scale = 0;
135
136
97
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
97
                    const auto* from_decimal_type =
138
97
                            check_and_get_data_type<FromDataType>(from_type.get());
139
97
                    from_precision =
140
97
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
97
                    from_scale = from_decimal_type->get_scale();
142
97
                }
143
144
97
                UInt32 to_max_digits = 0;
145
97
                UInt32 to_precision = 0;
146
97
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
97
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
97
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
97
                    to_precision = to_max_digits;
162
97
                }
163
164
97
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
97
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
97
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
97
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
97
                return narrow_integral || multiply_may_overflow;
173
97
            }
174
0
            return false;
175
97
        });
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
122
554
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
554
            using Types2 = std::decay_t<decltype(types2)>;
124
554
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
554
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
554
                using FromFieldType = typename FromDataType::FieldType;
132
554
                using ToFieldType = typename ToDataType::FieldType;
133
554
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
554
                UInt32 from_scale = 0;
135
136
554
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
554
                    const auto* from_decimal_type =
138
554
                            check_and_get_data_type<FromDataType>(from_type.get());
139
554
                    from_precision =
140
554
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
554
                    from_scale = from_decimal_type->get_scale();
142
554
                }
143
144
554
                UInt32 to_max_digits = 0;
145
554
                UInt32 to_precision = 0;
146
554
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
554
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
554
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
554
                    to_precision = to_max_digits;
162
554
                }
163
164
554
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
554
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
554
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
554
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
554
                return narrow_integral || multiply_may_overflow;
173
554
            }
174
0
            return false;
175
554
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
122
39
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
39
            using Types2 = std::decay_t<decltype(types2)>;
124
39
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
39
            return false;
175
39
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
122
7.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7.78k
            using Types2 = std::decay_t<decltype(types2)>;
124
7.78k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7.78k
            return false;
175
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
122
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
162
            using Types2 = std::decay_t<decltype(types2)>;
124
162
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
162
            return false;
175
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
122
1.74k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.74k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.74k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1.74k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1.74k
                return false;
129
1.74k
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1.74k
            return false;
175
1.74k
        });
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
122
296
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
296
            using Types2 = std::decay_t<decltype(types2)>;
124
296
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
296
            return false;
175
296
        });
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
122
436
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
436
            using Types2 = std::decay_t<decltype(types2)>;
124
436
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
436
            return false;
175
436
        });
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
122
886
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
886
            using Types2 = std::decay_t<decltype(types2)>;
124
886
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
886
            return false;
175
886
        });
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
122
1.10k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.10k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.10k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1.10k
            return false;
175
1.10k
        });
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
122
1.47k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.47k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.47k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1.47k
            return false;
175
1.47k
        });
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
122
194
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
194
            using Types2 = std::decay_t<decltype(types2)>;
124
194
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
194
            return false;
175
194
        });
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
122
2.77k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2.77k
            using Types2 = std::decay_t<decltype(types2)>;
124
2.77k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2.77k
            return false;
175
2.77k
        });
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
122
402
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
402
            using Types2 = std::decay_t<decltype(types2)>;
124
402
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
402
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
402
                using FromFieldType = typename FromDataType::FieldType;
132
402
                using ToFieldType = typename ToDataType::FieldType;
133
402
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
402
                UInt32 from_scale = 0;
135
136
402
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
402
                    const auto* from_decimal_type =
138
402
                            check_and_get_data_type<FromDataType>(from_type.get());
139
402
                    from_precision =
140
402
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
402
                    from_scale = from_decimal_type->get_scale();
142
402
                }
143
144
402
                UInt32 to_max_digits = 0;
145
402
                UInt32 to_precision = 0;
146
402
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
402
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
402
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
402
                    to_precision = to_max_digits;
162
402
                }
163
164
402
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
402
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
402
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
402
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
402
                return narrow_integral || multiply_may_overflow;
173
402
            }
174
0
            return false;
175
402
        });
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
122
350
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
350
            using Types2 = std::decay_t<decltype(types2)>;
124
350
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
350
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
350
                using FromFieldType = typename FromDataType::FieldType;
132
350
                using ToFieldType = typename ToDataType::FieldType;
133
350
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
350
                UInt32 from_scale = 0;
135
136
350
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
350
                    const auto* from_decimal_type =
138
350
                            check_and_get_data_type<FromDataType>(from_type.get());
139
350
                    from_precision =
140
350
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
350
                    from_scale = from_decimal_type->get_scale();
142
350
                }
143
144
350
                UInt32 to_max_digits = 0;
145
350
                UInt32 to_precision = 0;
146
350
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
350
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
350
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
350
                    to_precision = to_max_digits;
162
350
                }
163
164
350
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
350
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
350
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
350
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
350
                return narrow_integral || multiply_may_overflow;
173
350
            }
174
0
            return false;
175
350
        });
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
122
55
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
55
            using Types2 = std::decay_t<decltype(types2)>;
124
55
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
55
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
55
                using FromFieldType = typename FromDataType::FieldType;
132
55
                using ToFieldType = typename ToDataType::FieldType;
133
55
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
55
                UInt32 from_scale = 0;
135
136
55
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
55
                    const auto* from_decimal_type =
138
55
                            check_and_get_data_type<FromDataType>(from_type.get());
139
55
                    from_precision =
140
55
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
55
                    from_scale = from_decimal_type->get_scale();
142
55
                }
143
144
55
                UInt32 to_max_digits = 0;
145
55
                UInt32 to_precision = 0;
146
55
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
55
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
55
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
55
                    to_precision = to_max_digits;
162
55
                }
163
164
55
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
55
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
55
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
55
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
56
                return narrow_integral || multiply_may_overflow;
173
55
            }
174
0
            return false;
175
55
        });
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
122
782
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
782
            using Types2 = std::decay_t<decltype(types2)>;
124
782
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
782
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
782
                using FromFieldType = typename FromDataType::FieldType;
132
782
                using ToFieldType = typename ToDataType::FieldType;
133
782
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
782
                UInt32 from_scale = 0;
135
136
782
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
782
                    const auto* from_decimal_type =
138
782
                            check_and_get_data_type<FromDataType>(from_type.get());
139
782
                    from_precision =
140
782
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
782
                    from_scale = from_decimal_type->get_scale();
142
782
                }
143
144
782
                UInt32 to_max_digits = 0;
145
782
                UInt32 to_precision = 0;
146
782
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
782
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
782
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
782
                    to_precision = to_max_digits;
162
782
                }
163
164
782
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
782
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
782
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
782
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
782
                return narrow_integral || multiply_may_overflow;
173
782
            }
174
0
            return false;
175
782
        });
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
122
544
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
544
            using Types2 = std::decay_t<decltype(types2)>;
124
544
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
544
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
544
                using FromFieldType = typename FromDataType::FieldType;
132
544
                using ToFieldType = typename ToDataType::FieldType;
133
544
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
544
                UInt32 from_scale = 0;
135
136
544
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
544
                    const auto* from_decimal_type =
138
544
                            check_and_get_data_type<FromDataType>(from_type.get());
139
544
                    from_precision =
140
544
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
544
                    from_scale = from_decimal_type->get_scale();
142
544
                }
143
144
544
                UInt32 to_max_digits = 0;
145
544
                UInt32 to_precision = 0;
146
544
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
544
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
544
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
544
                    to_precision = to_max_digits;
162
544
                }
163
164
544
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
544
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
544
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
544
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
544
                return narrow_integral || multiply_may_overflow;
173
544
            }
174
0
            return false;
175
544
        });
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
122
89
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
89
            using Types2 = std::decay_t<decltype(types2)>;
124
89
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
89
            return false;
175
89
        });
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
122
7.84k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7.84k
            using Types2 = std::decay_t<decltype(types2)>;
124
7.84k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7.84k
            return false;
175
7.84k
        });
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
122
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
162
            using Types2 = std::decay_t<decltype(types2)>;
124
162
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
162
            return false;
175
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
122
6.59k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
6.59k
            using Types2 = std::decay_t<decltype(types2)>;
124
6.59k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
6.59k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
6.59k
                return false;
129
6.59k
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
6.59k
            return false;
175
6.59k
        });
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
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
18
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
18
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
18
                    const auto* to_decimal_type =
152
18
                            check_and_get_data_type<ToDataType>(to_type.get());
153
18
                    to_precision = to_decimal_type->get_precision();
154
18
                    ToDataType::check_type_precision(to_precision);
155
156
18
                    to_scale = to_decimal_type->get_scale();
157
18
                    ToDataType::check_type_scale(to_scale);
158
18
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
18
                    multiply_may_overflow &=
170
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
18
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
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
122
469
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
469
            using Types2 = std::decay_t<decltype(types2)>;
124
469
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
469
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
469
                using FromFieldType = typename FromDataType::FieldType;
132
469
                using ToFieldType = typename ToDataType::FieldType;
133
469
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
469
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
469
                UInt32 to_max_digits = 0;
145
469
                UInt32 to_precision = 0;
146
469
                UInt32 to_scale = 0;
147
148
469
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
469
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
469
                    const auto* to_decimal_type =
152
469
                            check_and_get_data_type<ToDataType>(to_type.get());
153
469
                    to_precision = to_decimal_type->get_precision();
154
469
                    ToDataType::check_type_precision(to_precision);
155
156
469
                    to_scale = to_decimal_type->get_scale();
157
469
                    ToDataType::check_type_scale(to_scale);
158
469
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
469
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
469
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
469
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
469
                if (to_scale > from_scale) {
169
266
                    multiply_may_overflow &=
170
266
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
266
                }
172
469
                return narrow_integral || multiply_may_overflow;
173
469
            }
174
0
            return false;
175
469
        });
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
122
498
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
498
            using Types2 = std::decay_t<decltype(types2)>;
124
498
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
498
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
498
                using FromFieldType = typename FromDataType::FieldType;
132
498
                using ToFieldType = typename ToDataType::FieldType;
133
498
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
498
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
498
                UInt32 to_max_digits = 0;
145
498
                UInt32 to_precision = 0;
146
498
                UInt32 to_scale = 0;
147
148
498
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
498
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
498
                    const auto* to_decimal_type =
152
498
                            check_and_get_data_type<ToDataType>(to_type.get());
153
498
                    to_precision = to_decimal_type->get_precision();
154
498
                    ToDataType::check_type_precision(to_precision);
155
156
498
                    to_scale = to_decimal_type->get_scale();
157
498
                    ToDataType::check_type_scale(to_scale);
158
498
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
498
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
498
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
498
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
498
                if (to_scale > from_scale) {
169
252
                    multiply_may_overflow &=
170
252
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
252
                }
172
498
                return narrow_integral || multiply_may_overflow;
173
498
            }
174
0
            return false;
175
498
        });
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
122
553
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
553
            using Types2 = std::decay_t<decltype(types2)>;
124
553
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
553
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
553
                using FromFieldType = typename FromDataType::FieldType;
132
553
                using ToFieldType = typename ToDataType::FieldType;
133
553
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
553
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
553
                UInt32 to_max_digits = 0;
145
553
                UInt32 to_precision = 0;
146
553
                UInt32 to_scale = 0;
147
148
553
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
553
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
553
                    const auto* to_decimal_type =
152
553
                            check_and_get_data_type<ToDataType>(to_type.get());
153
553
                    to_precision = to_decimal_type->get_precision();
154
553
                    ToDataType::check_type_precision(to_precision);
155
156
553
                    to_scale = to_decimal_type->get_scale();
157
553
                    ToDataType::check_type_scale(to_scale);
158
553
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
553
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
553
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
553
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
553
                if (to_scale > from_scale) {
169
280
                    multiply_may_overflow &=
170
280
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
280
                }
172
553
                return narrow_integral || multiply_may_overflow;
173
553
            }
174
0
            return false;
175
553
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
122
612
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
612
            using Types2 = std::decay_t<decltype(types2)>;
124
612
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
612
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
612
                using FromFieldType = typename FromDataType::FieldType;
132
612
                using ToFieldType = typename ToDataType::FieldType;
133
612
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
612
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
612
                UInt32 to_max_digits = 0;
145
612
                UInt32 to_precision = 0;
146
612
                UInt32 to_scale = 0;
147
148
612
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
612
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
612
                    const auto* to_decimal_type =
152
612
                            check_and_get_data_type<ToDataType>(to_type.get());
153
612
                    to_precision = to_decimal_type->get_precision();
154
612
                    ToDataType::check_type_precision(to_precision);
155
156
612
                    to_scale = to_decimal_type->get_scale();
157
612
                    ToDataType::check_type_scale(to_scale);
158
612
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
612
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
612
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
612
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
612
                if (to_scale > from_scale) {
169
266
                    multiply_may_overflow &=
170
266
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
266
                }
172
612
                return narrow_integral || multiply_may_overflow;
173
612
            }
174
0
            return false;
175
612
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
122
549
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
549
            using Types2 = std::decay_t<decltype(types2)>;
124
549
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
549
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
549
                using FromFieldType = typename FromDataType::FieldType;
132
549
                using ToFieldType = typename ToDataType::FieldType;
133
549
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
549
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
549
                UInt32 to_max_digits = 0;
145
549
                UInt32 to_precision = 0;
146
549
                UInt32 to_scale = 0;
147
148
549
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
549
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
549
                    const auto* to_decimal_type =
152
549
                            check_and_get_data_type<ToDataType>(to_type.get());
153
549
                    to_precision = to_decimal_type->get_precision();
154
549
                    ToDataType::check_type_precision(to_precision);
155
156
549
                    to_scale = to_decimal_type->get_scale();
157
549
                    ToDataType::check_type_scale(to_scale);
158
549
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
549
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
549
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
549
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
549
                if (to_scale > from_scale) {
169
278
                    multiply_may_overflow &=
170
278
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
278
                }
172
549
                return narrow_integral || multiply_may_overflow;
173
549
            }
174
0
            return false;
175
549
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
104
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
104
            using Types2 = std::decay_t<decltype(types2)>;
124
104
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
104
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
104
                using FromFieldType = typename FromDataType::FieldType;
132
104
                using ToFieldType = typename ToDataType::FieldType;
133
104
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
104
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
104
                UInt32 to_max_digits = 0;
145
104
                UInt32 to_precision = 0;
146
104
                UInt32 to_scale = 0;
147
148
104
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
104
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
104
                    const auto* to_decimal_type =
152
104
                            check_and_get_data_type<ToDataType>(to_type.get());
153
104
                    to_precision = to_decimal_type->get_precision();
154
104
                    ToDataType::check_type_precision(to_precision);
155
156
104
                    to_scale = to_decimal_type->get_scale();
157
104
                    ToDataType::check_type_scale(to_scale);
158
104
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
104
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
104
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
104
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
104
                if (to_scale > from_scale) {
169
68
                    multiply_may_overflow &=
170
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
68
                }
172
104
                return narrow_integral || multiply_may_overflow;
173
104
            }
174
0
            return false;
175
104
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
308
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
308
            using Types2 = std::decay_t<decltype(types2)>;
124
308
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
308
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
308
                using FromFieldType = typename FromDataType::FieldType;
132
308
                using ToFieldType = typename ToDataType::FieldType;
133
308
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
308
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
308
                UInt32 to_max_digits = 0;
145
308
                UInt32 to_precision = 0;
146
308
                UInt32 to_scale = 0;
147
148
308
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
308
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
308
                    const auto* to_decimal_type =
152
308
                            check_and_get_data_type<ToDataType>(to_type.get());
153
308
                    to_precision = to_decimal_type->get_precision();
154
308
                    ToDataType::check_type_precision(to_precision);
155
156
308
                    to_scale = to_decimal_type->get_scale();
157
308
                    ToDataType::check_type_scale(to_scale);
158
308
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
308
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
308
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
308
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
308
                if (to_scale > from_scale) {
169
258
                    multiply_may_overflow &=
170
258
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
258
                }
172
308
                return narrow_integral || multiply_may_overflow;
173
308
            }
174
0
            return false;
175
308
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
122
397
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
397
            using Types2 = std::decay_t<decltype(types2)>;
124
397
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
397
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
397
                using FromFieldType = typename FromDataType::FieldType;
132
397
                using ToFieldType = typename ToDataType::FieldType;
133
397
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
397
                UInt32 from_scale = 0;
135
136
397
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
397
                    const auto* from_decimal_type =
138
397
                            check_and_get_data_type<FromDataType>(from_type.get());
139
397
                    from_precision =
140
397
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
397
                    from_scale = from_decimal_type->get_scale();
142
397
                }
143
144
397
                UInt32 to_max_digits = 0;
145
397
                UInt32 to_precision = 0;
146
397
                UInt32 to_scale = 0;
147
148
397
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
397
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
397
                    const auto* to_decimal_type =
152
397
                            check_and_get_data_type<ToDataType>(to_type.get());
153
397
                    to_precision = to_decimal_type->get_precision();
154
397
                    ToDataType::check_type_precision(to_precision);
155
156
397
                    to_scale = to_decimal_type->get_scale();
157
397
                    ToDataType::check_type_scale(to_scale);
158
397
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
397
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
397
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
397
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
397
                if (to_scale > from_scale) {
169
90
                    multiply_may_overflow &=
170
90
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
90
                }
172
397
                return narrow_integral || multiply_may_overflow;
173
397
            }
174
0
            return false;
175
397
        });
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
122
620
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
620
            using Types2 = std::decay_t<decltype(types2)>;
124
620
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
620
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
620
                using FromFieldType = typename FromDataType::FieldType;
132
620
                using ToFieldType = typename ToDataType::FieldType;
133
620
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
620
                UInt32 from_scale = 0;
135
136
620
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
620
                    const auto* from_decimal_type =
138
620
                            check_and_get_data_type<FromDataType>(from_type.get());
139
620
                    from_precision =
140
620
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
620
                    from_scale = from_decimal_type->get_scale();
142
620
                }
143
144
620
                UInt32 to_max_digits = 0;
145
620
                UInt32 to_precision = 0;
146
620
                UInt32 to_scale = 0;
147
148
620
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
620
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
620
                    const auto* to_decimal_type =
152
620
                            check_and_get_data_type<ToDataType>(to_type.get());
153
620
                    to_precision = to_decimal_type->get_precision();
154
620
                    ToDataType::check_type_precision(to_precision);
155
156
620
                    to_scale = to_decimal_type->get_scale();
157
620
                    ToDataType::check_type_scale(to_scale);
158
620
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
620
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
620
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
620
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
620
                if (to_scale > from_scale) {
169
198
                    multiply_may_overflow &=
170
198
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
198
                }
172
620
                return narrow_integral || multiply_may_overflow;
173
620
            }
174
0
            return false;
175
620
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
206
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
206
            using Types2 = std::decay_t<decltype(types2)>;
124
206
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
206
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
206
                using FromFieldType = typename FromDataType::FieldType;
132
206
                using ToFieldType = typename ToDataType::FieldType;
133
206
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
206
                UInt32 from_scale = 0;
135
136
206
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
206
                    const auto* from_decimal_type =
138
206
                            check_and_get_data_type<FromDataType>(from_type.get());
139
206
                    from_precision =
140
206
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
206
                    from_scale = from_decimal_type->get_scale();
142
206
                }
143
144
206
                UInt32 to_max_digits = 0;
145
206
                UInt32 to_precision = 0;
146
206
                UInt32 to_scale = 0;
147
148
206
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
206
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
206
                    const auto* to_decimal_type =
152
206
                            check_and_get_data_type<ToDataType>(to_type.get());
153
206
                    to_precision = to_decimal_type->get_precision();
154
206
                    ToDataType::check_type_precision(to_precision);
155
156
206
                    to_scale = to_decimal_type->get_scale();
157
206
                    ToDataType::check_type_scale(to_scale);
158
206
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
206
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
206
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
206
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
206
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
206
                return narrow_integral || multiply_may_overflow;
173
206
            }
174
0
            return false;
175
206
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
122
4.32k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
4.32k
            using Types2 = std::decay_t<decltype(types2)>;
124
4.32k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
4.32k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
4.32k
                using FromFieldType = typename FromDataType::FieldType;
132
4.32k
                using ToFieldType = typename ToDataType::FieldType;
133
4.32k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
4.32k
                UInt32 from_scale = 0;
135
136
4.32k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
4.32k
                    const auto* from_decimal_type =
138
4.32k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
4.32k
                    from_precision =
140
4.32k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
4.32k
                    from_scale = from_decimal_type->get_scale();
142
4.32k
                }
143
144
4.32k
                UInt32 to_max_digits = 0;
145
4.32k
                UInt32 to_precision = 0;
146
4.32k
                UInt32 to_scale = 0;
147
148
4.32k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
4.32k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
4.32k
                    const auto* to_decimal_type =
152
4.32k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
4.32k
                    to_precision = to_decimal_type->get_precision();
154
4.32k
                    ToDataType::check_type_precision(to_precision);
155
156
4.32k
                    to_scale = to_decimal_type->get_scale();
157
4.32k
                    ToDataType::check_type_scale(to_scale);
158
4.32k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
4.32k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
4.32k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
4.32k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
4.32k
                if (to_scale > from_scale) {
169
142
                    multiply_may_overflow &=
170
142
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
142
                }
172
4.32k
                return narrow_integral || multiply_may_overflow;
173
4.32k
            }
174
0
            return false;
175
4.32k
        });
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
122
303
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
303
            using Types2 = std::decay_t<decltype(types2)>;
124
303
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
303
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
303
                using FromFieldType = typename FromDataType::FieldType;
132
303
                using ToFieldType = typename ToDataType::FieldType;
133
303
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
303
                UInt32 from_scale = 0;
135
136
303
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
303
                    const auto* from_decimal_type =
138
303
                            check_and_get_data_type<FromDataType>(from_type.get());
139
303
                    from_precision =
140
303
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
303
                    from_scale = from_decimal_type->get_scale();
142
303
                }
143
144
303
                UInt32 to_max_digits = 0;
145
303
                UInt32 to_precision = 0;
146
303
                UInt32 to_scale = 0;
147
148
303
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
303
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
303
                    const auto* to_decimal_type =
152
303
                            check_and_get_data_type<ToDataType>(to_type.get());
153
303
                    to_precision = to_decimal_type->get_precision();
154
303
                    ToDataType::check_type_precision(to_precision);
155
156
303
                    to_scale = to_decimal_type->get_scale();
157
303
                    ToDataType::check_type_scale(to_scale);
158
303
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
303
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
303
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
303
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
303
                if (to_scale > from_scale) {
169
79
                    multiply_may_overflow &=
170
79
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
79
                }
172
303
                return narrow_integral || multiply_may_overflow;
173
303
            }
174
0
            return false;
175
303
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
122
2.91k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2.91k
            using Types2 = std::decay_t<decltype(types2)>;
124
2.91k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
2.91k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
2.91k
                return false;
129
2.91k
            }
130
2.91k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2.91k
                using FromFieldType = typename FromDataType::FieldType;
132
2.91k
                using ToFieldType = typename ToDataType::FieldType;
133
2.91k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2.91k
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
2.91k
                UInt32 to_max_digits = 0;
145
2.91k
                UInt32 to_precision = 0;
146
2.91k
                UInt32 to_scale = 0;
147
148
2.91k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
2.91k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
2.91k
                    const auto* to_decimal_type =
152
2.91k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
2.91k
                    to_precision = to_decimal_type->get_precision();
154
2.91k
                    ToDataType::check_type_precision(to_precision);
155
156
2.91k
                    to_scale = to_decimal_type->get_scale();
157
2.91k
                    ToDataType::check_type_scale(to_scale);
158
2.91k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
2.91k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2.91k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2.91k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2.91k
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
2.91k
                return narrow_integral || multiply_may_overflow;
173
2.91k
            }
174
0
            return false;
175
2.91k
        });
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
122
17
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
17
            using Types2 = std::decay_t<decltype(types2)>;
124
17
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
17
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
17
                using FromFieldType = typename FromDataType::FieldType;
132
17
                using ToFieldType = typename ToDataType::FieldType;
133
17
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
17
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
17
                UInt32 to_max_digits = 0;
145
17
                UInt32 to_precision = 0;
146
17
                UInt32 to_scale = 0;
147
148
17
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
17
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
17
                    const auto* to_decimal_type =
152
17
                            check_and_get_data_type<ToDataType>(to_type.get());
153
17
                    to_precision = to_decimal_type->get_precision();
154
17
                    ToDataType::check_type_precision(to_precision);
155
156
17
                    to_scale = to_decimal_type->get_scale();
157
17
                    ToDataType::check_type_scale(to_scale);
158
17
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
17
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
17
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
17
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
17
                if (to_scale > from_scale) {
169
16
                    multiply_may_overflow &=
170
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
16
                }
172
17
                return narrow_integral || multiply_may_overflow;
173
17
            }
174
0
            return false;
175
17
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
72
            using Types2 = std::decay_t<decltype(types2)>;
124
72
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
72
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
72
                using FromFieldType = typename FromDataType::FieldType;
132
72
                using ToFieldType = typename ToDataType::FieldType;
133
72
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
72
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
72
                UInt32 to_max_digits = 0;
145
72
                UInt32 to_precision = 0;
146
72
                UInt32 to_scale = 0;
147
148
72
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
72
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
72
                    const auto* to_decimal_type =
152
72
                            check_and_get_data_type<ToDataType>(to_type.get());
153
72
                    to_precision = to_decimal_type->get_precision();
154
72
                    ToDataType::check_type_precision(to_precision);
155
156
72
                    to_scale = to_decimal_type->get_scale();
157
72
                    ToDataType::check_type_scale(to_scale);
158
72
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
72
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
72
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
72
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
72
                if (to_scale > from_scale) {
169
59
                    multiply_may_overflow &=
170
59
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
59
                }
172
72
                return narrow_integral || multiply_may_overflow;
173
72
            }
174
0
            return false;
175
72
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
122
48
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
48
            using Types2 = std::decay_t<decltype(types2)>;
124
48
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
48
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
48
                using FromFieldType = typename FromDataType::FieldType;
132
48
                using ToFieldType = typename ToDataType::FieldType;
133
48
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
48
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
48
                UInt32 to_max_digits = 0;
145
48
                UInt32 to_precision = 0;
146
48
                UInt32 to_scale = 0;
147
148
48
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
48
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
48
                    const auto* to_decimal_type =
152
48
                            check_and_get_data_type<ToDataType>(to_type.get());
153
48
                    to_precision = to_decimal_type->get_precision();
154
48
                    ToDataType::check_type_precision(to_precision);
155
156
48
                    to_scale = to_decimal_type->get_scale();
157
48
                    ToDataType::check_type_scale(to_scale);
158
48
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
48
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
48
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
48
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
48
                if (to_scale > from_scale) {
169
38
                    multiply_may_overflow &=
170
38
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
38
                }
172
48
                return narrow_integral || multiply_may_overflow;
173
48
            }
174
0
            return false;
175
48
        });
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
122
464
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
464
            using Types2 = std::decay_t<decltype(types2)>;
124
464
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
464
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
464
                using FromFieldType = typename FromDataType::FieldType;
132
464
                using ToFieldType = typename ToDataType::FieldType;
133
464
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
464
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
464
                UInt32 to_max_digits = 0;
145
464
                UInt32 to_precision = 0;
146
464
                UInt32 to_scale = 0;
147
148
464
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
464
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
464
                    const auto* to_decimal_type =
152
464
                            check_and_get_data_type<ToDataType>(to_type.get());
153
464
                    to_precision = to_decimal_type->get_precision();
154
464
                    ToDataType::check_type_precision(to_precision);
155
156
464
                    to_scale = to_decimal_type->get_scale();
157
464
                    ToDataType::check_type_scale(to_scale);
158
464
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
464
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
464
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
464
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
464
                if (to_scale > from_scale) {
169
312
                    multiply_may_overflow &=
170
312
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
312
                }
172
464
                return narrow_integral || multiply_may_overflow;
173
464
            }
174
0
            return false;
175
464
        });
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
122
53
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
53
            using Types2 = std::decay_t<decltype(types2)>;
124
53
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
53
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
53
                using FromFieldType = typename FromDataType::FieldType;
132
53
                using ToFieldType = typename ToDataType::FieldType;
133
53
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
53
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
53
                UInt32 to_max_digits = 0;
145
53
                UInt32 to_precision = 0;
146
53
                UInt32 to_scale = 0;
147
148
53
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
53
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
53
                    const auto* to_decimal_type =
152
53
                            check_and_get_data_type<ToDataType>(to_type.get());
153
53
                    to_precision = to_decimal_type->get_precision();
154
53
                    ToDataType::check_type_precision(to_precision);
155
156
53
                    to_scale = to_decimal_type->get_scale();
157
53
                    ToDataType::check_type_scale(to_scale);
158
53
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
53
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
53
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
53
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
53
                if (to_scale > from_scale) {
169
32
                    multiply_may_overflow &=
170
32
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
32
                }
172
53
                return narrow_integral || multiply_may_overflow;
173
53
            }
174
0
            return false;
175
53
        });
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
122
65
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
65
            using Types2 = std::decay_t<decltype(types2)>;
124
65
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
65
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
65
                using FromFieldType = typename FromDataType::FieldType;
132
65
                using ToFieldType = typename ToDataType::FieldType;
133
65
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
65
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
65
                UInt32 to_max_digits = 0;
145
65
                UInt32 to_precision = 0;
146
65
                UInt32 to_scale = 0;
147
148
65
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
65
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
65
                    const auto* to_decimal_type =
152
65
                            check_and_get_data_type<ToDataType>(to_type.get());
153
65
                    to_precision = to_decimal_type->get_precision();
154
65
                    ToDataType::check_type_precision(to_precision);
155
156
65
                    to_scale = to_decimal_type->get_scale();
157
65
                    ToDataType::check_type_scale(to_scale);
158
65
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
65
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
65
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
65
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
65
                if (to_scale > from_scale) {
169
39
                    multiply_may_overflow &=
170
39
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
39
                }
172
65
                return narrow_integral || multiply_may_overflow;
173
65
            }
174
0
            return false;
175
65
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
107
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
107
            using Types2 = std::decay_t<decltype(types2)>;
124
107
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
107
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
107
                using FromFieldType = typename FromDataType::FieldType;
132
107
                using ToFieldType = typename ToDataType::FieldType;
133
107
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
107
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
107
                UInt32 to_max_digits = 0;
145
107
                UInt32 to_precision = 0;
146
107
                UInt32 to_scale = 0;
147
148
107
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
107
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
107
                    const auto* to_decimal_type =
152
107
                            check_and_get_data_type<ToDataType>(to_type.get());
153
107
                    to_precision = to_decimal_type->get_precision();
154
107
                    ToDataType::check_type_precision(to_precision);
155
156
107
                    to_scale = to_decimal_type->get_scale();
157
107
                    ToDataType::check_type_scale(to_scale);
158
107
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
107
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
107
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
107
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
107
                if (to_scale > from_scale) {
169
65
                    multiply_may_overflow &=
170
65
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
65
                }
172
107
                return narrow_integral || multiply_may_overflow;
173
107
            }
174
0
            return false;
175
107
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
215
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
215
            using Types2 = std::decay_t<decltype(types2)>;
124
215
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
215
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
215
                using FromFieldType = typename FromDataType::FieldType;
132
215
                using ToFieldType = typename ToDataType::FieldType;
133
215
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
215
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
215
                UInt32 to_max_digits = 0;
145
215
                UInt32 to_precision = 0;
146
215
                UInt32 to_scale = 0;
147
148
215
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
215
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
215
                    const auto* to_decimal_type =
152
215
                            check_and_get_data_type<ToDataType>(to_type.get());
153
215
                    to_precision = to_decimal_type->get_precision();
154
215
                    ToDataType::check_type_precision(to_precision);
155
156
215
                    to_scale = to_decimal_type->get_scale();
157
215
                    ToDataType::check_type_scale(to_scale);
158
215
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
215
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
215
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
215
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
215
                if (to_scale > from_scale) {
169
182
                    multiply_may_overflow &=
170
182
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
182
                }
172
215
                return narrow_integral || multiply_may_overflow;
173
215
            }
174
0
            return false;
175
215
        });
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
122
1.11k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.11k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.11k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
1.11k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1.11k
                using FromFieldType = typename FromDataType::FieldType;
132
1.11k
                using ToFieldType = typename ToDataType::FieldType;
133
1.11k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1.11k
                UInt32 from_scale = 0;
135
136
1.11k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
1.11k
                    const auto* from_decimal_type =
138
1.11k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
1.11k
                    from_precision =
140
1.11k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
1.11k
                    from_scale = from_decimal_type->get_scale();
142
1.11k
                }
143
144
1.11k
                UInt32 to_max_digits = 0;
145
1.11k
                UInt32 to_precision = 0;
146
1.11k
                UInt32 to_scale = 0;
147
148
1.11k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1.11k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1.11k
                    const auto* to_decimal_type =
152
1.11k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1.11k
                    to_precision = to_decimal_type->get_precision();
154
1.11k
                    ToDataType::check_type_precision(to_precision);
155
156
1.11k
                    to_scale = to_decimal_type->get_scale();
157
1.11k
                    ToDataType::check_type_scale(to_scale);
158
1.11k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
1.11k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1.11k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1.11k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1.11k
                if (to_scale > from_scale) {
169
767
                    multiply_may_overflow &=
170
767
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
767
                }
172
1.11k
                return narrow_integral || multiply_may_overflow;
173
1.11k
            }
174
0
            return false;
175
1.11k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
122
10.5k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
10.5k
            using Types2 = std::decay_t<decltype(types2)>;
124
10.5k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
10.5k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
10.5k
                using FromFieldType = typename FromDataType::FieldType;
132
10.5k
                using ToFieldType = typename ToDataType::FieldType;
133
10.5k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
10.5k
                UInt32 from_scale = 0;
135
136
10.5k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
10.5k
                    const auto* from_decimal_type =
138
10.5k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
10.5k
                    from_precision =
140
10.5k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
10.5k
                    from_scale = from_decimal_type->get_scale();
142
10.5k
                }
143
144
10.5k
                UInt32 to_max_digits = 0;
145
10.5k
                UInt32 to_precision = 0;
146
10.5k
                UInt32 to_scale = 0;
147
148
10.5k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
10.5k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
10.5k
                    const auto* to_decimal_type =
152
10.5k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
10.5k
                    to_precision = to_decimal_type->get_precision();
154
10.5k
                    ToDataType::check_type_precision(to_precision);
155
156
10.5k
                    to_scale = to_decimal_type->get_scale();
157
10.5k
                    ToDataType::check_type_scale(to_scale);
158
10.5k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
10.5k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
10.5k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
10.5k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
10.5k
                if (to_scale > from_scale) {
169
157
                    multiply_may_overflow &=
170
157
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
157
                }
172
10.5k
                return narrow_integral || multiply_may_overflow;
173
10.5k
            }
174
0
            return false;
175
10.5k
        });
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
122
216
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
216
            using Types2 = std::decay_t<decltype(types2)>;
124
216
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
216
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
216
                using FromFieldType = typename FromDataType::FieldType;
132
216
                using ToFieldType = typename ToDataType::FieldType;
133
216
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
216
                UInt32 from_scale = 0;
135
136
216
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
216
                    const auto* from_decimal_type =
138
216
                            check_and_get_data_type<FromDataType>(from_type.get());
139
216
                    from_precision =
140
216
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
216
                    from_scale = from_decimal_type->get_scale();
142
216
                }
143
144
216
                UInt32 to_max_digits = 0;
145
216
                UInt32 to_precision = 0;
146
216
                UInt32 to_scale = 0;
147
148
216
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
216
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
216
                    const auto* to_decimal_type =
152
216
                            check_and_get_data_type<ToDataType>(to_type.get());
153
216
                    to_precision = to_decimal_type->get_precision();
154
216
                    ToDataType::check_type_precision(to_precision);
155
156
216
                    to_scale = to_decimal_type->get_scale();
157
216
                    ToDataType::check_type_scale(to_scale);
158
216
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
216
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
216
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
216
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
216
                if (to_scale > from_scale) {
169
50
                    multiply_may_overflow &=
170
50
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
50
                }
172
216
                return narrow_integral || multiply_may_overflow;
173
216
            }
174
0
            return false;
175
216
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
122
9.97k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
9.97k
            using Types2 = std::decay_t<decltype(types2)>;
124
9.97k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
9.97k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
9.97k
                using FromFieldType = typename FromDataType::FieldType;
132
9.97k
                using ToFieldType = typename ToDataType::FieldType;
133
9.97k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
9.97k
                UInt32 from_scale = 0;
135
136
9.97k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
9.97k
                    const auto* from_decimal_type =
138
9.97k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
9.97k
                    from_precision =
140
9.97k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
9.97k
                    from_scale = from_decimal_type->get_scale();
142
9.97k
                }
143
144
9.97k
                UInt32 to_max_digits = 0;
145
9.97k
                UInt32 to_precision = 0;
146
9.97k
                UInt32 to_scale = 0;
147
148
9.97k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
9.97k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
9.97k
                    const auto* to_decimal_type =
152
9.97k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
9.97k
                    to_precision = to_decimal_type->get_precision();
154
9.97k
                    ToDataType::check_type_precision(to_precision);
155
156
9.97k
                    to_scale = to_decimal_type->get_scale();
157
9.97k
                    ToDataType::check_type_scale(to_scale);
158
9.97k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
9.97k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
9.97k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
9.97k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
9.97k
                if (to_scale > from_scale) {
169
146
                    multiply_may_overflow &=
170
146
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
146
                }
172
9.97k
                return narrow_integral || multiply_may_overflow;
173
9.97k
            }
174
0
            return false;
175
9.97k
        });
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
122
401
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
401
            using Types2 = std::decay_t<decltype(types2)>;
124
401
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
401
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
401
                using FromFieldType = typename FromDataType::FieldType;
132
401
                using ToFieldType = typename ToDataType::FieldType;
133
401
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
401
                UInt32 from_scale = 0;
135
136
401
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
401
                    const auto* from_decimal_type =
138
401
                            check_and_get_data_type<FromDataType>(from_type.get());
139
401
                    from_precision =
140
401
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
401
                    from_scale = from_decimal_type->get_scale();
142
401
                }
143
144
401
                UInt32 to_max_digits = 0;
145
401
                UInt32 to_precision = 0;
146
401
                UInt32 to_scale = 0;
147
148
401
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
401
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
401
                    const auto* to_decimal_type =
152
401
                            check_and_get_data_type<ToDataType>(to_type.get());
153
401
                    to_precision = to_decimal_type->get_precision();
154
401
                    ToDataType::check_type_precision(to_precision);
155
156
401
                    to_scale = to_decimal_type->get_scale();
157
401
                    ToDataType::check_type_scale(to_scale);
158
401
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
401
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
401
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
401
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
401
                if (to_scale > from_scale) {
169
137
                    multiply_may_overflow &=
170
137
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
137
                }
172
401
                return narrow_integral || multiply_may_overflow;
173
401
            }
174
0
            return false;
175
401
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
122
7.93k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7.93k
            using Types2 = std::decay_t<decltype(types2)>;
124
7.93k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
7.93k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
7.93k
                return false;
129
7.93k
            }
130
7.93k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
7.93k
                using FromFieldType = typename FromDataType::FieldType;
132
7.93k
                using ToFieldType = typename ToDataType::FieldType;
133
7.93k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
7.93k
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
7.93k
                UInt32 to_max_digits = 0;
145
7.93k
                UInt32 to_precision = 0;
146
7.93k
                UInt32 to_scale = 0;
147
148
7.93k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
7.93k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
7.93k
                    const auto* to_decimal_type =
152
7.93k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
7.93k
                    to_precision = to_decimal_type->get_precision();
154
7.93k
                    ToDataType::check_type_precision(to_precision);
155
156
7.93k
                    to_scale = to_decimal_type->get_scale();
157
7.93k
                    ToDataType::check_type_scale(to_scale);
158
7.93k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
7.93k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
7.93k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
7.93k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
7.93k
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
7.93k
                return narrow_integral || multiply_may_overflow;
173
7.93k
            }
174
0
            return false;
175
7.93k
        });
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
122
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
20
            using Types2 = std::decay_t<decltype(types2)>;
124
20
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
20
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
20
                using FromFieldType = typename FromDataType::FieldType;
132
20
                using ToFieldType = typename ToDataType::FieldType;
133
20
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
20
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
20
                UInt32 to_max_digits = 0;
145
20
                UInt32 to_precision = 0;
146
20
                UInt32 to_scale = 0;
147
148
20
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
20
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
20
                    const auto* to_decimal_type =
152
20
                            check_and_get_data_type<ToDataType>(to_type.get());
153
20
                    to_precision = to_decimal_type->get_precision();
154
20
                    ToDataType::check_type_precision(to_precision);
155
156
20
                    to_scale = to_decimal_type->get_scale();
157
20
                    ToDataType::check_type_scale(to_scale);
158
20
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
20
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
20
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
20
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
20
                if (to_scale > from_scale) {
169
20
                    multiply_may_overflow &=
170
20
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
20
                }
172
20
                return narrow_integral || multiply_may_overflow;
173
20
            }
174
0
            return false;
175
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
16
            using Types2 = std::decay_t<decltype(types2)>;
124
16
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
16
                using FromFieldType = typename FromDataType::FieldType;
132
16
                using ToFieldType = typename ToDataType::FieldType;
133
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
16
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
16
                UInt32 to_max_digits = 0;
145
16
                UInt32 to_precision = 0;
146
16
                UInt32 to_scale = 0;
147
148
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
16
                    const auto* to_decimal_type =
152
16
                            check_and_get_data_type<ToDataType>(to_type.get());
153
16
                    to_precision = to_decimal_type->get_precision();
154
16
                    ToDataType::check_type_precision(to_precision);
155
156
16
                    to_scale = to_decimal_type->get_scale();
157
16
                    ToDataType::check_type_scale(to_scale);
158
16
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
16
                if (to_scale > from_scale) {
169
16
                    multiply_may_overflow &=
170
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
16
                }
172
16
                return narrow_integral || multiply_may_overflow;
173
16
            }
174
0
            return false;
175
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
122
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
16
            using Types2 = std::decay_t<decltype(types2)>;
124
16
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
16
                using FromFieldType = typename FromDataType::FieldType;
132
16
                using ToFieldType = typename ToDataType::FieldType;
133
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
16
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
16
                UInt32 to_max_digits = 0;
145
16
                UInt32 to_precision = 0;
146
16
                UInt32 to_scale = 0;
147
148
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
16
                    const auto* to_decimal_type =
152
16
                            check_and_get_data_type<ToDataType>(to_type.get());
153
16
                    to_precision = to_decimal_type->get_precision();
154
16
                    ToDataType::check_type_precision(to_precision);
155
156
16
                    to_scale = to_decimal_type->get_scale();
157
16
                    ToDataType::check_type_scale(to_scale);
158
16
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
16
                if (to_scale > from_scale) {
169
16
                    multiply_may_overflow &=
170
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
16
                }
172
16
                return narrow_integral || multiply_may_overflow;
173
16
            }
174
0
            return false;
175
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
122
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
16
            using Types2 = std::decay_t<decltype(types2)>;
124
16
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
16
                using FromFieldType = typename FromDataType::FieldType;
132
16
                using ToFieldType = typename ToDataType::FieldType;
133
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
16
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
16
                UInt32 to_max_digits = 0;
145
16
                UInt32 to_precision = 0;
146
16
                UInt32 to_scale = 0;
147
148
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
16
                    const auto* to_decimal_type =
152
16
                            check_and_get_data_type<ToDataType>(to_type.get());
153
16
                    to_precision = to_decimal_type->get_precision();
154
16
                    ToDataType::check_type_precision(to_precision);
155
156
16
                    to_scale = to_decimal_type->get_scale();
157
16
                    ToDataType::check_type_scale(to_scale);
158
16
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
16
                if (to_scale > from_scale) {
169
16
                    multiply_may_overflow &=
170
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
16
                }
172
16
                return narrow_integral || multiply_may_overflow;
173
16
            }
174
0
            return false;
175
16
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
32
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
32
            using Types2 = std::decay_t<decltype(types2)>;
124
32
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
32
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
32
                using FromFieldType = typename FromDataType::FieldType;
132
32
                using ToFieldType = typename ToDataType::FieldType;
133
32
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
32
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
32
                UInt32 to_max_digits = 0;
145
32
                UInt32 to_precision = 0;
146
32
                UInt32 to_scale = 0;
147
148
32
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
32
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
32
                    const auto* to_decimal_type =
152
32
                            check_and_get_data_type<ToDataType>(to_type.get());
153
32
                    to_precision = to_decimal_type->get_precision();
154
32
                    ToDataType::check_type_precision(to_precision);
155
156
32
                    to_scale = to_decimal_type->get_scale();
157
32
                    ToDataType::check_type_scale(to_scale);
158
32
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
32
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
32
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
32
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
32
                if (to_scale > from_scale) {
169
32
                    multiply_may_overflow &=
170
32
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
32
                }
172
32
                return narrow_integral || multiply_may_overflow;
173
32
            }
174
0
            return false;
175
32
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
128
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
128
            using Types2 = std::decay_t<decltype(types2)>;
124
128
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
128
                using FromFieldType = typename FromDataType::FieldType;
132
128
                using ToFieldType = typename ToDataType::FieldType;
133
128
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
128
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
128
                UInt32 to_max_digits = 0;
145
128
                UInt32 to_precision = 0;
146
128
                UInt32 to_scale = 0;
147
148
128
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
128
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
128
                    const auto* to_decimal_type =
152
128
                            check_and_get_data_type<ToDataType>(to_type.get());
153
128
                    to_precision = to_decimal_type->get_precision();
154
128
                    ToDataType::check_type_precision(to_precision);
155
156
128
                    to_scale = to_decimal_type->get_scale();
157
128
                    ToDataType::check_type_scale(to_scale);
158
128
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
128
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
128
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
128
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
128
                if (to_scale > from_scale) {
169
128
                    multiply_may_overflow &=
170
128
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
128
                }
172
128
                return narrow_integral || multiply_may_overflow;
173
128
            }
174
0
            return false;
175
128
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
122
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1
            using Types2 = std::decay_t<decltype(types2)>;
124
1
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1
                return false;
129
1
            }
130
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1
                using FromFieldType = typename FromDataType::FieldType;
132
1
                using ToFieldType = typename ToDataType::FieldType;
133
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
1
                UInt32 to_max_digits = 0;
145
1
                UInt32 to_precision = 0;
146
1
                UInt32 to_scale = 0;
147
148
1
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1
                    const auto* to_decimal_type =
152
1
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1
                    to_precision = to_decimal_type->get_precision();
154
1
                    ToDataType::check_type_precision(to_precision);
155
156
1
                    to_scale = to_decimal_type->get_scale();
157
1
                    ToDataType::check_type_scale(to_scale);
158
1
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
1
                return narrow_integral || multiply_may_overflow;
173
1
            }
174
0
            return false;
175
1
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
122
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
23
            using Types2 = std::decay_t<decltype(types2)>;
124
23
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
23
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
23
                using FromFieldType = typename FromDataType::FieldType;
132
23
                using ToFieldType = typename ToDataType::FieldType;
133
23
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
23
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
23
                UInt32 to_max_digits = 0;
145
23
                UInt32 to_precision = 0;
146
23
                UInt32 to_scale = 0;
147
148
23
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
23
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
23
                    const auto* to_decimal_type =
152
23
                            check_and_get_data_type<ToDataType>(to_type.get());
153
23
                    to_precision = to_decimal_type->get_precision();
154
23
                    ToDataType::check_type_precision(to_precision);
155
156
23
                    to_scale = to_decimal_type->get_scale();
157
23
                    ToDataType::check_type_scale(to_scale);
158
23
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
23
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
23
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
23
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
23
                if (to_scale > from_scale) {
169
22
                    multiply_may_overflow &=
170
22
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
22
                }
172
23
                return narrow_integral || multiply_may_overflow;
173
23
            }
174
0
            return false;
175
23
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
179
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
179
            using Types2 = std::decay_t<decltype(types2)>;
124
179
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
179
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
179
                using FromFieldType = typename FromDataType::FieldType;
132
179
                using ToFieldType = typename ToDataType::FieldType;
133
179
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
179
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
179
                UInt32 to_max_digits = 0;
145
179
                UInt32 to_precision = 0;
146
179
                UInt32 to_scale = 0;
147
148
179
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
179
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
179
                    const auto* to_decimal_type =
152
179
                            check_and_get_data_type<ToDataType>(to_type.get());
153
179
                    to_precision = to_decimal_type->get_precision();
154
179
                    ToDataType::check_type_precision(to_precision);
155
156
179
                    to_scale = to_decimal_type->get_scale();
157
179
                    ToDataType::check_type_scale(to_scale);
158
179
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
179
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
179
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
179
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
179
                if (to_scale > from_scale) {
169
128
                    multiply_may_overflow &=
170
128
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
128
                }
172
179
                return narrow_integral || multiply_may_overflow;
173
179
            }
174
0
            return false;
175
179
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
122
166
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
166
            using Types2 = std::decay_t<decltype(types2)>;
124
166
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
166
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
166
                using FromFieldType = typename FromDataType::FieldType;
132
166
                using ToFieldType = typename ToDataType::FieldType;
133
166
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
166
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
166
                UInt32 to_max_digits = 0;
145
166
                UInt32 to_precision = 0;
146
166
                UInt32 to_scale = 0;
147
148
166
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
166
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
166
                    const auto* to_decimal_type =
152
166
                            check_and_get_data_type<ToDataType>(to_type.get());
153
166
                    to_precision = to_decimal_type->get_precision();
154
166
                    ToDataType::check_type_precision(to_precision);
155
156
166
                    to_scale = to_decimal_type->get_scale();
157
166
                    ToDataType::check_type_scale(to_scale);
158
166
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
166
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
166
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
166
                if (to_scale > from_scale) {
169
115
                    multiply_may_overflow &=
170
115
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
115
                }
172
166
                return narrow_integral || multiply_may_overflow;
173
166
            }
174
0
            return false;
175
166
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
122
457
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
457
            using Types2 = std::decay_t<decltype(types2)>;
124
457
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
457
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
457
                using FromFieldType = typename FromDataType::FieldType;
132
457
                using ToFieldType = typename ToDataType::FieldType;
133
457
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
457
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
457
                UInt32 to_max_digits = 0;
145
457
                UInt32 to_precision = 0;
146
457
                UInt32 to_scale = 0;
147
148
457
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
457
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
457
                    const auto* to_decimal_type =
152
457
                            check_and_get_data_type<ToDataType>(to_type.get());
153
457
                    to_precision = to_decimal_type->get_precision();
154
457
                    ToDataType::check_type_precision(to_precision);
155
156
457
                    to_scale = to_decimal_type->get_scale();
157
457
                    ToDataType::check_type_scale(to_scale);
158
457
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
457
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
457
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
457
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
457
                if (to_scale > from_scale) {
169
401
                    multiply_may_overflow &=
170
401
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
401
                }
172
457
                return narrow_integral || multiply_may_overflow;
173
457
            }
174
0
            return false;
175
457
        });
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
122
2.91k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2.91k
            using Types2 = std::decay_t<decltype(types2)>;
124
2.91k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
2.91k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2.91k
                using FromFieldType = typename FromDataType::FieldType;
132
2.91k
                using ToFieldType = typename ToDataType::FieldType;
133
2.91k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2.91k
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
2.91k
                UInt32 to_max_digits = 0;
145
2.91k
                UInt32 to_precision = 0;
146
2.91k
                UInt32 to_scale = 0;
147
148
2.91k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
2.91k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
2.91k
                    const auto* to_decimal_type =
152
2.91k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
2.91k
                    to_precision = to_decimal_type->get_precision();
154
2.91k
                    ToDataType::check_type_precision(to_precision);
155
156
2.91k
                    to_scale = to_decimal_type->get_scale();
157
2.91k
                    ToDataType::check_type_scale(to_scale);
158
2.91k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
2.91k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2.91k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2.91k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2.91k
                if (to_scale > from_scale) {
169
519
                    multiply_may_overflow &=
170
519
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
519
                }
172
2.91k
                return narrow_integral || multiply_may_overflow;
173
2.91k
            }
174
0
            return false;
175
2.91k
        });
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
122
367
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
367
            using Types2 = std::decay_t<decltype(types2)>;
124
367
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
367
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
367
                using FromFieldType = typename FromDataType::FieldType;
132
367
                using ToFieldType = typename ToDataType::FieldType;
133
367
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
367
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
367
                UInt32 to_max_digits = 0;
145
367
                UInt32 to_precision = 0;
146
367
                UInt32 to_scale = 0;
147
148
367
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
367
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
367
                    const auto* to_decimal_type =
152
367
                            check_and_get_data_type<ToDataType>(to_type.get());
153
367
                    to_precision = to_decimal_type->get_precision();
154
367
                    ToDataType::check_type_precision(to_precision);
155
156
367
                    to_scale = to_decimal_type->get_scale();
157
367
                    ToDataType::check_type_scale(to_scale);
158
367
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
367
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
367
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
367
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
367
                if (to_scale > from_scale) {
169
196
                    multiply_may_overflow &=
170
196
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
196
                }
172
367
                return narrow_integral || multiply_may_overflow;
173
367
            }
174
0
            return false;
175
367
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
248
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
248
            using Types2 = std::decay_t<decltype(types2)>;
124
248
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
248
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
248
                using FromFieldType = typename FromDataType::FieldType;
132
248
                using ToFieldType = typename ToDataType::FieldType;
133
248
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
248
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
248
                UInt32 to_max_digits = 0;
145
248
                UInt32 to_precision = 0;
146
248
                UInt32 to_scale = 0;
147
148
248
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
248
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
248
                    const auto* to_decimal_type =
152
248
                            check_and_get_data_type<ToDataType>(to_type.get());
153
248
                    to_precision = to_decimal_type->get_precision();
154
248
                    ToDataType::check_type_precision(to_precision);
155
156
248
                    to_scale = to_decimal_type->get_scale();
157
248
                    ToDataType::check_type_scale(to_scale);
158
248
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
248
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
248
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
248
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
248
                if (to_scale > from_scale) {
169
130
                    multiply_may_overflow &=
170
130
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
130
                }
172
248
                return narrow_integral || multiply_may_overflow;
173
248
            }
174
0
            return false;
175
248
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
489
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
489
            using Types2 = std::decay_t<decltype(types2)>;
124
489
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
489
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
489
                using FromFieldType = typename FromDataType::FieldType;
132
489
                using ToFieldType = typename ToDataType::FieldType;
133
489
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
489
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
489
                UInt32 to_max_digits = 0;
145
489
                UInt32 to_precision = 0;
146
489
                UInt32 to_scale = 0;
147
148
489
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
489
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
489
                    const auto* to_decimal_type =
152
489
                            check_and_get_data_type<ToDataType>(to_type.get());
153
489
                    to_precision = to_decimal_type->get_precision();
154
489
                    ToDataType::check_type_precision(to_precision);
155
156
489
                    to_scale = to_decimal_type->get_scale();
157
489
                    ToDataType::check_type_scale(to_scale);
158
489
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
489
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
489
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
489
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
489
                if (to_scale > from_scale) {
169
379
                    multiply_may_overflow &=
170
379
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
379
                }
172
489
                return narrow_integral || multiply_may_overflow;
173
489
            }
174
0
            return false;
175
489
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
122
739
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
739
            using Types2 = std::decay_t<decltype(types2)>;
124
739
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
739
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
739
                using FromFieldType = typename FromDataType::FieldType;
132
739
                using ToFieldType = typename ToDataType::FieldType;
133
739
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
739
                UInt32 from_scale = 0;
135
136
739
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
739
                    const auto* from_decimal_type =
138
739
                            check_and_get_data_type<FromDataType>(from_type.get());
139
739
                    from_precision =
140
739
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
739
                    from_scale = from_decimal_type->get_scale();
142
739
                }
143
144
739
                UInt32 to_max_digits = 0;
145
739
                UInt32 to_precision = 0;
146
739
                UInt32 to_scale = 0;
147
148
739
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
739
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
739
                    const auto* to_decimal_type =
152
739
                            check_and_get_data_type<ToDataType>(to_type.get());
153
739
                    to_precision = to_decimal_type->get_precision();
154
739
                    ToDataType::check_type_precision(to_precision);
155
156
739
                    to_scale = to_decimal_type->get_scale();
157
739
                    ToDataType::check_type_scale(to_scale);
158
739
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
739
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
739
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
739
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
739
                if (to_scale > from_scale) {
169
597
                    multiply_may_overflow &=
170
597
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
597
                }
172
739
                return narrow_integral || multiply_may_overflow;
173
739
            }
174
0
            return false;
175
739
        });
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
122
1.60k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.60k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.60k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
1.60k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1.60k
                using FromFieldType = typename FromDataType::FieldType;
132
1.60k
                using ToFieldType = typename ToDataType::FieldType;
133
1.60k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1.60k
                UInt32 from_scale = 0;
135
136
1.60k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
1.60k
                    const auto* from_decimal_type =
138
1.60k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
1.60k
                    from_precision =
140
1.60k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
1.60k
                    from_scale = from_decimal_type->get_scale();
142
1.60k
                }
143
144
1.60k
                UInt32 to_max_digits = 0;
145
1.60k
                UInt32 to_precision = 0;
146
1.60k
                UInt32 to_scale = 0;
147
148
1.60k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1.60k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1.60k
                    const auto* to_decimal_type =
152
1.60k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1.60k
                    to_precision = to_decimal_type->get_precision();
154
1.60k
                    ToDataType::check_type_precision(to_precision);
155
156
1.60k
                    to_scale = to_decimal_type->get_scale();
157
1.60k
                    ToDataType::check_type_scale(to_scale);
158
1.60k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
1.60k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1.60k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1.60k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1.60k
                if (to_scale > from_scale) {
169
718
                    multiply_may_overflow &=
170
718
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
718
                }
172
1.60k
                return narrow_integral || multiply_may_overflow;
173
1.60k
            }
174
0
            return false;
175
1.60k
        });
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
122
255
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
255
            using Types2 = std::decay_t<decltype(types2)>;
124
255
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
255
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
255
                using FromFieldType = typename FromDataType::FieldType;
132
255
                using ToFieldType = typename ToDataType::FieldType;
133
255
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
255
                UInt32 from_scale = 0;
135
136
255
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
255
                    const auto* from_decimal_type =
138
255
                            check_and_get_data_type<FromDataType>(from_type.get());
139
255
                    from_precision =
140
255
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
255
                    from_scale = from_decimal_type->get_scale();
142
255
                }
143
144
255
                UInt32 to_max_digits = 0;
145
255
                UInt32 to_precision = 0;
146
255
                UInt32 to_scale = 0;
147
148
255
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
255
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
255
                    const auto* to_decimal_type =
152
255
                            check_and_get_data_type<ToDataType>(to_type.get());
153
255
                    to_precision = to_decimal_type->get_precision();
154
255
                    ToDataType::check_type_precision(to_precision);
155
156
255
                    to_scale = to_decimal_type->get_scale();
157
255
                    ToDataType::check_type_scale(to_scale);
158
255
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
255
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
255
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
255
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
255
                if (to_scale > from_scale) {
169
71
                    multiply_may_overflow &=
170
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
71
                }
172
255
                return narrow_integral || multiply_may_overflow;
173
255
            }
174
0
            return false;
175
255
        });
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
122
2.90k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2.90k
            using Types2 = std::decay_t<decltype(types2)>;
124
2.90k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
2.90k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2.90k
                using FromFieldType = typename FromDataType::FieldType;
132
2.90k
                using ToFieldType = typename ToDataType::FieldType;
133
2.90k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2.90k
                UInt32 from_scale = 0;
135
136
2.90k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
2.90k
                    const auto* from_decimal_type =
138
2.90k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
2.90k
                    from_precision =
140
2.90k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
2.90k
                    from_scale = from_decimal_type->get_scale();
142
2.90k
                }
143
144
2.90k
                UInt32 to_max_digits = 0;
145
2.90k
                UInt32 to_precision = 0;
146
2.90k
                UInt32 to_scale = 0;
147
148
2.90k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
2.90k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
2.90k
                    const auto* to_decimal_type =
152
2.90k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
2.90k
                    to_precision = to_decimal_type->get_precision();
154
2.90k
                    ToDataType::check_type_precision(to_precision);
155
156
2.90k
                    to_scale = to_decimal_type->get_scale();
157
2.90k
                    ToDataType::check_type_scale(to_scale);
158
2.90k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
2.90k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2.90k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2.90k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2.90k
                if (to_scale > from_scale) {
169
710
                    multiply_may_overflow &=
170
710
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
710
                }
172
2.90k
                return narrow_integral || multiply_may_overflow;
173
2.90k
            }
174
0
            return false;
175
2.90k
        });
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
122
948
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
948
            using Types2 = std::decay_t<decltype(types2)>;
124
948
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
948
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
948
                using FromFieldType = typename FromDataType::FieldType;
132
948
                using ToFieldType = typename ToDataType::FieldType;
133
948
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
948
                UInt32 from_scale = 0;
135
136
948
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
948
                    const auto* from_decimal_type =
138
948
                            check_and_get_data_type<FromDataType>(from_type.get());
139
948
                    from_precision =
140
948
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
948
                    from_scale = from_decimal_type->get_scale();
142
948
                }
143
144
948
                UInt32 to_max_digits = 0;
145
948
                UInt32 to_precision = 0;
146
948
                UInt32 to_scale = 0;
147
148
948
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
948
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
948
                    const auto* to_decimal_type =
152
948
                            check_and_get_data_type<ToDataType>(to_type.get());
153
948
                    to_precision = to_decimal_type->get_precision();
154
948
                    ToDataType::check_type_precision(to_precision);
155
156
948
                    to_scale = to_decimal_type->get_scale();
157
948
                    ToDataType::check_type_scale(to_scale);
158
948
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
948
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
948
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
948
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
948
                if (to_scale > from_scale) {
169
394
                    multiply_may_overflow &=
170
394
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
394
                }
172
948
                return narrow_integral || multiply_may_overflow;
173
948
            }
174
0
            return false;
175
948
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
122
174k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
174k
            using Types2 = std::decay_t<decltype(types2)>;
124
174k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
174k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
174k
                return false;
129
174k
            }
130
174k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
174k
                using FromFieldType = typename FromDataType::FieldType;
132
174k
                using ToFieldType = typename ToDataType::FieldType;
133
174k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
174k
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
174k
                UInt32 to_max_digits = 0;
145
174k
                UInt32 to_precision = 0;
146
174k
                UInt32 to_scale = 0;
147
148
174k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
174k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
174k
                    const auto* to_decimal_type =
152
174k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
174k
                    to_precision = to_decimal_type->get_precision();
154
174k
                    ToDataType::check_type_precision(to_precision);
155
156
174k
                    to_scale = to_decimal_type->get_scale();
157
174k
                    ToDataType::check_type_scale(to_scale);
158
174k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
174k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
174k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
174k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
174k
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
174k
                return narrow_integral || multiply_may_overflow;
173
174k
            }
174
0
            return false;
175
174k
        });
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
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
7
                using FromFieldType = typename FromDataType::FieldType;
132
7
                using ToFieldType = typename ToDataType::FieldType;
133
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
7
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
7
                UInt32 to_max_digits = 0;
145
7
                UInt32 to_precision = 0;
146
7
                UInt32 to_scale = 0;
147
148
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
7
                    const auto* to_decimal_type =
152
7
                            check_and_get_data_type<ToDataType>(to_type.get());
153
7
                    to_precision = to_decimal_type->get_precision();
154
7
                    ToDataType::check_type_precision(to_precision);
155
156
7
                    to_scale = to_decimal_type->get_scale();
157
7
                    ToDataType::check_type_scale(to_scale);
158
7
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
7
                if (to_scale > from_scale) {
169
6
                    multiply_may_overflow &=
170
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
6
                }
172
7
                return narrow_integral || multiply_may_overflow;
173
7
            }
174
0
            return false;
175
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
122
160
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
160
            using Types2 = std::decay_t<decltype(types2)>;
124
160
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
160
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
160
                using FromFieldType = typename FromDataType::FieldType;
132
160
                using ToFieldType = typename ToDataType::FieldType;
133
160
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
160
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
160
                UInt32 to_max_digits = 0;
145
160
                UInt32 to_precision = 0;
146
160
                UInt32 to_scale = 0;
147
148
160
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
160
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
160
                    const auto* to_decimal_type =
152
160
                            check_and_get_data_type<ToDataType>(to_type.get());
153
160
                    to_precision = to_decimal_type->get_precision();
154
160
                    ToDataType::check_type_precision(to_precision);
155
156
160
                    to_scale = to_decimal_type->get_scale();
157
160
                    ToDataType::check_type_scale(to_scale);
158
160
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
160
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
160
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
160
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
160
                if (to_scale > from_scale) {
169
109
                    multiply_may_overflow &=
170
109
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
109
                }
172
160
                return narrow_integral || multiply_may_overflow;
173
160
            }
174
0
            return false;
175
160
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
122
158
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
158
            using Types2 = std::decay_t<decltype(types2)>;
124
158
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
158
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
158
                using FromFieldType = typename FromDataType::FieldType;
132
158
                using ToFieldType = typename ToDataType::FieldType;
133
158
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
158
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
158
                UInt32 to_max_digits = 0;
145
158
                UInt32 to_precision = 0;
146
158
                UInt32 to_scale = 0;
147
148
158
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
158
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
158
                    const auto* to_decimal_type =
152
158
                            check_and_get_data_type<ToDataType>(to_type.get());
153
158
                    to_precision = to_decimal_type->get_precision();
154
158
                    ToDataType::check_type_precision(to_precision);
155
156
158
                    to_scale = to_decimal_type->get_scale();
157
158
                    ToDataType::check_type_scale(to_scale);
158
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
158
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
158
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
158
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
158
                if (to_scale > from_scale) {
169
107
                    multiply_may_overflow &=
170
107
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
107
                }
172
158
                return narrow_integral || multiply_may_overflow;
173
158
            }
174
0
            return false;
175
158
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
122
176
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
176
            using Types2 = std::decay_t<decltype(types2)>;
124
176
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
176
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
176
                using FromFieldType = typename FromDataType::FieldType;
132
176
                using ToFieldType = typename ToDataType::FieldType;
133
176
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
176
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
176
                UInt32 to_max_digits = 0;
145
176
                UInt32 to_precision = 0;
146
176
                UInt32 to_scale = 0;
147
148
176
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
176
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
176
                    const auto* to_decimal_type =
152
176
                            check_and_get_data_type<ToDataType>(to_type.get());
153
176
                    to_precision = to_decimal_type->get_precision();
154
176
                    ToDataType::check_type_precision(to_precision);
155
156
176
                    to_scale = to_decimal_type->get_scale();
157
176
                    ToDataType::check_type_scale(to_scale);
158
176
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
176
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
176
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
176
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
176
                if (to_scale > from_scale) {
169
120
                    multiply_may_overflow &=
170
120
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
120
                }
172
176
                return narrow_integral || multiply_may_overflow;
173
176
            }
174
0
            return false;
175
176
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
122
158
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
158
            using Types2 = std::decay_t<decltype(types2)>;
124
158
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
158
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
158
                using FromFieldType = typename FromDataType::FieldType;
132
158
                using ToFieldType = typename ToDataType::FieldType;
133
158
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
158
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
158
                UInt32 to_max_digits = 0;
145
158
                UInt32 to_precision = 0;
146
158
                UInt32 to_scale = 0;
147
148
158
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
158
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
158
                    const auto* to_decimal_type =
152
158
                            check_and_get_data_type<ToDataType>(to_type.get());
153
158
                    to_precision = to_decimal_type->get_precision();
154
158
                    ToDataType::check_type_precision(to_precision);
155
156
158
                    to_scale = to_decimal_type->get_scale();
157
158
                    ToDataType::check_type_scale(to_scale);
158
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
158
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
158
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
158
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
158
                if (to_scale > from_scale) {
169
107
                    multiply_may_overflow &=
170
107
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
107
                }
172
158
                return narrow_integral || multiply_may_overflow;
173
158
            }
174
0
            return false;
175
158
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
122
232
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
232
            using Types2 = std::decay_t<decltype(types2)>;
124
232
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
232
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
232
                using FromFieldType = typename FromDataType::FieldType;
132
232
                using ToFieldType = typename ToDataType::FieldType;
133
232
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
232
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
232
                UInt32 to_max_digits = 0;
145
232
                UInt32 to_precision = 0;
146
232
                UInt32 to_scale = 0;
147
148
232
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
232
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
232
                    const auto* to_decimal_type =
152
232
                            check_and_get_data_type<ToDataType>(to_type.get());
153
232
                    to_precision = to_decimal_type->get_precision();
154
232
                    ToDataType::check_type_precision(to_precision);
155
156
232
                    to_scale = to_decimal_type->get_scale();
157
232
                    ToDataType::check_type_scale(to_scale);
158
232
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
232
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
232
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
232
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
232
                if (to_scale > from_scale) {
169
170
                    multiply_may_overflow &=
170
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
170
                }
172
232
                return narrow_integral || multiply_may_overflow;
173
232
            }
174
0
            return false;
175
232
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
224
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
224
            using Types2 = std::decay_t<decltype(types2)>;
124
224
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
224
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
224
                using FromFieldType = typename FromDataType::FieldType;
132
224
                using ToFieldType = typename ToDataType::FieldType;
133
224
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
224
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
224
                UInt32 to_max_digits = 0;
145
224
                UInt32 to_precision = 0;
146
224
                UInt32 to_scale = 0;
147
148
224
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
224
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
224
                    const auto* to_decimal_type =
152
224
                            check_and_get_data_type<ToDataType>(to_type.get());
153
224
                    to_precision = to_decimal_type->get_precision();
154
224
                    ToDataType::check_type_precision(to_precision);
155
156
224
                    to_scale = to_decimal_type->get_scale();
157
224
                    ToDataType::check_type_scale(to_scale);
158
224
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
224
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
224
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
224
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
224
                if (to_scale > from_scale) {
169
126
                    multiply_may_overflow &=
170
126
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
126
                }
172
224
                return narrow_integral || multiply_may_overflow;
173
224
            }
174
0
            return false;
175
224
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
318
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
318
            using Types2 = std::decay_t<decltype(types2)>;
124
318
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
318
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
318
                using FromFieldType = typename FromDataType::FieldType;
132
318
                using ToFieldType = typename ToDataType::FieldType;
133
318
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
318
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
318
                UInt32 to_max_digits = 0;
145
318
                UInt32 to_precision = 0;
146
318
                UInt32 to_scale = 0;
147
148
318
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
318
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
318
                    const auto* to_decimal_type =
152
318
                            check_and_get_data_type<ToDataType>(to_type.get());
153
318
                    to_precision = to_decimal_type->get_precision();
154
318
                    ToDataType::check_type_precision(to_precision);
155
156
318
                    to_scale = to_decimal_type->get_scale();
157
318
                    ToDataType::check_type_scale(to_scale);
158
318
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
318
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
318
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
318
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
318
                if (to_scale > from_scale) {
169
208
                    multiply_may_overflow &=
170
208
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
208
                }
172
318
                return narrow_integral || multiply_may_overflow;
173
318
            }
174
0
            return false;
175
318
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
122
567
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
567
            using Types2 = std::decay_t<decltype(types2)>;
124
567
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
567
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
567
                using FromFieldType = typename FromDataType::FieldType;
132
567
                using ToFieldType = typename ToDataType::FieldType;
133
567
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
567
                UInt32 from_scale = 0;
135
136
567
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
567
                    const auto* from_decimal_type =
138
567
                            check_and_get_data_type<FromDataType>(from_type.get());
139
567
                    from_precision =
140
567
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
567
                    from_scale = from_decimal_type->get_scale();
142
567
                }
143
144
567
                UInt32 to_max_digits = 0;
145
567
                UInt32 to_precision = 0;
146
567
                UInt32 to_scale = 0;
147
148
567
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
567
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
567
                    const auto* to_decimal_type =
152
567
                            check_and_get_data_type<ToDataType>(to_type.get());
153
567
                    to_precision = to_decimal_type->get_precision();
154
567
                    ToDataType::check_type_precision(to_precision);
155
156
567
                    to_scale = to_decimal_type->get_scale();
157
567
                    ToDataType::check_type_scale(to_scale);
158
567
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
567
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
567
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
567
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
567
                if (to_scale > from_scale) {
169
499
                    multiply_may_overflow &=
170
499
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
499
                }
172
567
                return narrow_integral || multiply_may_overflow;
173
567
            }
174
0
            return false;
175
567
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
122
919
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
919
            using Types2 = std::decay_t<decltype(types2)>;
124
919
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
919
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
919
                using FromFieldType = typename FromDataType::FieldType;
132
919
                using ToFieldType = typename ToDataType::FieldType;
133
919
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
919
                UInt32 from_scale = 0;
135
136
919
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
919
                    const auto* from_decimal_type =
138
919
                            check_and_get_data_type<FromDataType>(from_type.get());
139
919
                    from_precision =
140
919
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
919
                    from_scale = from_decimal_type->get_scale();
142
919
                }
143
144
919
                UInt32 to_max_digits = 0;
145
919
                UInt32 to_precision = 0;
146
919
                UInt32 to_scale = 0;
147
148
919
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
919
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
919
                    const auto* to_decimal_type =
152
919
                            check_and_get_data_type<ToDataType>(to_type.get());
153
919
                    to_precision = to_decimal_type->get_precision();
154
919
                    ToDataType::check_type_precision(to_precision);
155
156
919
                    to_scale = to_decimal_type->get_scale();
157
919
                    ToDataType::check_type_scale(to_scale);
158
919
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
919
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
919
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
919
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
919
                if (to_scale > from_scale) {
169
792
                    multiply_may_overflow &=
170
792
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
792
                }
172
919
                return narrow_integral || multiply_may_overflow;
173
919
            }
174
0
            return false;
175
919
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
148
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
148
            using Types2 = std::decay_t<decltype(types2)>;
124
148
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
148
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
148
                using FromFieldType = typename FromDataType::FieldType;
132
148
                using ToFieldType = typename ToDataType::FieldType;
133
148
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
148
                UInt32 from_scale = 0;
135
136
148
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
148
                    const auto* from_decimal_type =
138
148
                            check_and_get_data_type<FromDataType>(from_type.get());
139
148
                    from_precision =
140
148
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
148
                    from_scale = from_decimal_type->get_scale();
142
148
                }
143
144
148
                UInt32 to_max_digits = 0;
145
148
                UInt32 to_precision = 0;
146
148
                UInt32 to_scale = 0;
147
148
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
148
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
148
                    const auto* to_decimal_type =
152
148
                            check_and_get_data_type<ToDataType>(to_type.get());
153
148
                    to_precision = to_decimal_type->get_precision();
154
148
                    ToDataType::check_type_precision(to_precision);
155
156
148
                    to_scale = to_decimal_type->get_scale();
157
148
                    ToDataType::check_type_scale(to_scale);
158
148
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
148
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
148
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
148
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
148
                if (to_scale > from_scale) {
169
84
                    multiply_may_overflow &=
170
84
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
84
                }
172
148
                return narrow_integral || multiply_may_overflow;
173
148
            }
174
0
            return false;
175
148
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
122
1.19k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.19k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.19k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
1.19k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1.19k
                using FromFieldType = typename FromDataType::FieldType;
132
1.19k
                using ToFieldType = typename ToDataType::FieldType;
133
1.19k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1.19k
                UInt32 from_scale = 0;
135
136
1.19k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
1.19k
                    const auto* from_decimal_type =
138
1.19k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
1.19k
                    from_precision =
140
1.19k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
1.19k
                    from_scale = from_decimal_type->get_scale();
142
1.19k
                }
143
144
1.19k
                UInt32 to_max_digits = 0;
145
1.19k
                UInt32 to_precision = 0;
146
1.19k
                UInt32 to_scale = 0;
147
148
1.19k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1.19k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1.19k
                    const auto* to_decimal_type =
152
1.19k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1.19k
                    to_precision = to_decimal_type->get_precision();
154
1.19k
                    ToDataType::check_type_precision(to_precision);
155
156
1.19k
                    to_scale = to_decimal_type->get_scale();
157
1.19k
                    ToDataType::check_type_scale(to_scale);
158
1.19k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
1.19k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1.19k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1.19k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1.19k
                if (to_scale > from_scale) {
169
734
                    multiply_may_overflow &=
170
734
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
734
                }
172
1.19k
                return narrow_integral || multiply_may_overflow;
173
1.19k
            }
174
0
            return false;
175
1.19k
        });
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
122
918
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
918
            using Types2 = std::decay_t<decltype(types2)>;
124
918
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
918
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
918
                using FromFieldType = typename FromDataType::FieldType;
132
918
                using ToFieldType = typename ToDataType::FieldType;
133
918
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
918
                UInt32 from_scale = 0;
135
136
918
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
918
                    const auto* from_decimal_type =
138
918
                            check_and_get_data_type<FromDataType>(from_type.get());
139
918
                    from_precision =
140
918
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
918
                    from_scale = from_decimal_type->get_scale();
142
918
                }
143
144
918
                UInt32 to_max_digits = 0;
145
918
                UInt32 to_precision = 0;
146
918
                UInt32 to_scale = 0;
147
148
918
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
918
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
918
                    const auto* to_decimal_type =
152
918
                            check_and_get_data_type<ToDataType>(to_type.get());
153
918
                    to_precision = to_decimal_type->get_precision();
154
918
                    ToDataType::check_type_precision(to_precision);
155
156
918
                    to_scale = to_decimal_type->get_scale();
157
918
                    ToDataType::check_type_scale(to_scale);
158
918
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
918
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
918
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
918
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
918
                if (to_scale > from_scale) {
169
452
                    multiply_may_overflow &=
170
452
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
452
                }
172
918
                return narrow_integral || multiply_may_overflow;
173
918
            }
174
0
            return false;
175
918
        });
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
122
5.67k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
5.67k
            using Types2 = std::decay_t<decltype(types2)>;
124
5.67k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
5.67k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
5.67k
                return false;
129
5.67k
            }
130
5.67k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
5.67k
                using FromFieldType = typename FromDataType::FieldType;
132
5.67k
                using ToFieldType = typename ToDataType::FieldType;
133
5.67k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
5.67k
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
5.67k
                UInt32 to_max_digits = 0;
145
5.67k
                UInt32 to_precision = 0;
146
5.67k
                UInt32 to_scale = 0;
147
148
5.67k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
5.67k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
5.67k
                    const auto* to_decimal_type =
152
5.67k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
5.67k
                    to_precision = to_decimal_type->get_precision();
154
5.67k
                    ToDataType::check_type_precision(to_precision);
155
156
5.67k
                    to_scale = to_decimal_type->get_scale();
157
5.67k
                    ToDataType::check_type_scale(to_scale);
158
5.67k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
5.67k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
5.67k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
5.67k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
5.67k
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
5.67k
                return narrow_integral || multiply_may_overflow;
173
5.67k
            }
174
0
            return false;
175
5.67k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Line
Count
Source
122
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1
            using Types2 = std::decay_t<decltype(types2)>;
124
1
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1
            return false;
175
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
122
3
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
3
            using Types2 = std::decay_t<decltype(types2)>;
124
3
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
3
            return false;
175
3
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
122
28
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
28
            using Types2 = std::decay_t<decltype(types2)>;
124
28
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
28
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
28
                return false;
129
28
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
28
            return false;
175
28
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Line
Count
Source
122
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
10
            using Types2 = std::decay_t<decltype(types2)>;
124
10
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
10
            return false;
175
10
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
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
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
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
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2
                using FromFieldType = typename FromDataType::FieldType;
132
2
                using ToFieldType = typename ToDataType::FieldType;
133
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2
                UInt32 from_scale = 0;
135
136
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
2
                    const auto* from_decimal_type =
138
2
                            check_and_get_data_type<FromDataType>(from_type.get());
139
2
                    from_precision =
140
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
2
                    from_scale = from_decimal_type->get_scale();
142
2
                }
143
144
2
                UInt32 to_max_digits = 0;
145
2
                UInt32 to_precision = 0;
146
2
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
2
                return narrow_integral || multiply_may_overflow;
173
2
            }
174
0
            return false;
175
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Line
Count
Source
122
31
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
31
            using Types2 = std::decay_t<decltype(types2)>;
124
31
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
31
            return false;
175
31
        });
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
122
238
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
238
            using Types2 = std::decay_t<decltype(types2)>;
124
238
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
238
            return false;
175
238
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
122
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1
            using Types2 = std::decay_t<decltype(types2)>;
124
1
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1
            return false;
175
1
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
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
122
175k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
175k
            using Types2 = std::decay_t<decltype(types2)>;
124
175k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
175k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
175k
                return false;
129
175k
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
175k
            return false;
175
175k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Line
Count
Source
122
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
13
            using Types2 = std::decay_t<decltype(types2)>;
124
13
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
13
            return false;
175
13
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
122
33
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
33
            using Types2 = std::decay_t<decltype(types2)>;
124
33
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
33
            return false;
175
33
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
122
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
12
            using Types2 = std::decay_t<decltype(types2)>;
124
12
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
12
            return false;
175
12
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Line
Count
Source
122
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
12
            using Types2 = std::decay_t<decltype(types2)>;
124
12
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
12
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
12
                using FromFieldType = typename FromDataType::FieldType;
132
12
                using ToFieldType = typename ToDataType::FieldType;
133
12
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
12
                UInt32 from_scale = 0;
135
136
12
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
12
                    const auto* from_decimal_type =
138
12
                            check_and_get_data_type<FromDataType>(from_type.get());
139
12
                    from_precision =
140
12
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
12
                    from_scale = from_decimal_type->get_scale();
142
12
                }
143
144
12
                UInt32 to_max_digits = 0;
145
12
                UInt32 to_precision = 0;
146
12
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
12
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
12
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
12
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
12
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
12
                return narrow_integral || multiply_may_overflow;
173
12
            }
174
0
            return false;
175
12
        });
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
122
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
4
            using Types2 = std::decay_t<decltype(types2)>;
124
4
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
4
                using FromFieldType = typename FromDataType::FieldType;
132
4
                using ToFieldType = typename ToDataType::FieldType;
133
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
4
                UInt32 from_scale = 0;
135
136
4
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
4
                    const auto* from_decimal_type =
138
4
                            check_and_get_data_type<FromDataType>(from_type.get());
139
4
                    from_precision =
140
4
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
4
                    from_scale = from_decimal_type->get_scale();
142
4
                }
143
144
4
                UInt32 to_max_digits = 0;
145
4
                UInt32 to_precision = 0;
146
4
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
4
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
4
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
4
                return narrow_integral || multiply_may_overflow;
173
4
            }
174
0
            return false;
175
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_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Line
Count
Source
122
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
5
            using Types2 = std::decay_t<decltype(types2)>;
124
5
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
5
                using FromFieldType = typename FromDataType::FieldType;
132
5
                using ToFieldType = typename ToDataType::FieldType;
133
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
5
                UInt32 from_scale = 0;
135
136
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
5
                    const auto* from_decimal_type =
138
5
                            check_and_get_data_type<FromDataType>(from_type.get());
139
5
                    from_precision =
140
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
5
                    from_scale = from_decimal_type->get_scale();
142
5
                }
143
144
5
                UInt32 to_max_digits = 0;
145
5
                UInt32 to_precision = 0;
146
5
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
5
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
5
                return narrow_integral || multiply_may_overflow;
173
5
            }
174
0
            return false;
175
5
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Line
Count
Source
122
398
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
398
            using Types2 = std::decay_t<decltype(types2)>;
124
398
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
398
            return false;
175
398
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Line
Count
Source
122
257
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
257
            using Types2 = std::decay_t<decltype(types2)>;
124
257
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
257
            return false;
175
257
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
122
40
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
40
            using Types2 = std::decay_t<decltype(types2)>;
124
40
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
40
            return false;
175
40
        });
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
122
6
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
6
            using Types2 = std::decay_t<decltype(types2)>;
124
6
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
6
            return false;
175
6
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Line
Count
Source
122
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
21
            using Types2 = std::decay_t<decltype(types2)>;
124
21
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
21
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
21
                return false;
129
21
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
21
            return false;
175
21
        });
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
122
169k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
169k
            using Types2 = std::decay_t<decltype(types2)>;
124
169k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
169k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
169k
                return false;
129
169k
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
169k
            return false;
175
169k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
122
26
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
26
            using Types2 = std::decay_t<decltype(types2)>;
124
26
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
26
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
26
                return false;
129
26
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
26
            return false;
175
26
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Line
Count
Source
122
32
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
32
            using Types2 = std::decay_t<decltype(types2)>;
124
32
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
32
            return false;
175
32
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Line
Count
Source
122
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
21
            using Types2 = std::decay_t<decltype(types2)>;
124
21
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
21
            return false;
175
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Line
Count
Source
122
33
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
33
            using Types2 = std::decay_t<decltype(types2)>;
124
33
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
33
            return false;
175
33
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
122
9
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
9
            using Types2 = std::decay_t<decltype(types2)>;
124
9
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
9
            return false;
175
9
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Line
Count
Source
122
3
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
3
            using Types2 = std::decay_t<decltype(types2)>;
124
3
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
3
            return false;
175
3
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Line
Count
Source
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
18
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2
                using FromFieldType = typename FromDataType::FieldType;
132
2
                using ToFieldType = typename ToDataType::FieldType;
133
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2
                UInt32 from_scale = 0;
135
136
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
2
                    const auto* from_decimal_type =
138
2
                            check_and_get_data_type<FromDataType>(from_type.get());
139
2
                    from_precision =
140
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
2
                    from_scale = from_decimal_type->get_scale();
142
2
                }
143
144
2
                UInt32 to_max_digits = 0;
145
2
                UInt32 to_precision = 0;
146
2
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
2
                    to_precision = to_max_digits;
162
2
                }
163
164
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
2
                return narrow_integral || multiply_may_overflow;
173
2
            }
174
0
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Line
Count
Source
122
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1
            using Types2 = std::decay_t<decltype(types2)>;
124
1
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1
                using FromFieldType = typename FromDataType::FieldType;
132
1
                using ToFieldType = typename ToDataType::FieldType;
133
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1
                UInt32 from_scale = 0;
135
136
1
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
1
                    const auto* from_decimal_type =
138
1
                            check_and_get_data_type<FromDataType>(from_type.get());
139
1
                    from_precision =
140
1
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
1
                    from_scale = from_decimal_type->get_scale();
142
1
                }
143
144
1
                UInt32 to_max_digits = 0;
145
1
                UInt32 to_precision = 0;
146
1
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
1
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
1
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
1
                    to_precision = to_max_digits;
162
1
                }
163
164
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
1
                return narrow_integral || multiply_may_overflow;
173
1
            }
174
0
            return false;
175
1
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Line
Count
Source
122
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1
            using Types2 = std::decay_t<decltype(types2)>;
124
1
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1
                using FromFieldType = typename FromDataType::FieldType;
132
1
                using ToFieldType = typename ToDataType::FieldType;
133
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1
                UInt32 from_scale = 0;
135
136
1
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
1
                    const auto* from_decimal_type =
138
1
                            check_and_get_data_type<FromDataType>(from_type.get());
139
1
                    from_precision =
140
1
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
1
                    from_scale = from_decimal_type->get_scale();
142
1
                }
143
144
1
                UInt32 to_max_digits = 0;
145
1
                UInt32 to_precision = 0;
146
1
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
1
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
1
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
1
                    to_precision = to_max_digits;
162
1
                }
163
164
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
1
                return narrow_integral || multiply_may_overflow;
173
1
            }
174
0
            return false;
175
1
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Line
Count
Source
122
11
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
11
            using Types2 = std::decay_t<decltype(types2)>;
124
11
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
11
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
11
                using FromFieldType = typename FromDataType::FieldType;
132
11
                using ToFieldType = typename ToDataType::FieldType;
133
11
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
11
                UInt32 from_scale = 0;
135
136
11
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
11
                    const auto* from_decimal_type =
138
11
                            check_and_get_data_type<FromDataType>(from_type.get());
139
11
                    from_precision =
140
11
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
11
                    from_scale = from_decimal_type->get_scale();
142
11
                }
143
144
11
                UInt32 to_max_digits = 0;
145
11
                UInt32 to_precision = 0;
146
11
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
11
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
11
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
11
                    to_precision = to_max_digits;
162
11
                }
163
164
11
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
11
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
11
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
11
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
11
                return narrow_integral || multiply_may_overflow;
173
11
            }
174
0
            return false;
175
11
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Line
Count
Source
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
8
            return false;
175
8
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Line
Count
Source
122
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
21
            using Types2 = std::decay_t<decltype(types2)>;
124
21
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
21
            return false;
175
21
        });
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
122
301
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
301
            using Types2 = std::decay_t<decltype(types2)>;
124
301
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
301
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
301
                return false;
129
301
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
301
            return false;
175
301
        });
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_
176
1.32M
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
112
2.48k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
2.48k
        using Types = std::decay_t<decltype(types)>;
114
2.48k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
2.48k
        return call_on_index_and_data_type<
122
2.48k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2.48k
            using Types2 = std::decay_t<decltype(types2)>;
124
2.48k
            using FromDataType = typename Types2::LeftType;
125
2.48k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
2.48k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
2.48k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
2.48k
                return false;
129
2.48k
            }
130
2.48k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2.48k
                using FromFieldType = typename FromDataType::FieldType;
132
2.48k
                using ToFieldType = typename ToDataType::FieldType;
133
2.48k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2.48k
                UInt32 from_scale = 0;
135
136
2.48k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
2.48k
                    const auto* from_decimal_type =
138
2.48k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
2.48k
                    from_precision =
140
2.48k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
2.48k
                    from_scale = from_decimal_type->get_scale();
142
2.48k
                }
143
144
2.48k
                UInt32 to_max_digits = 0;
145
2.48k
                UInt32 to_precision = 0;
146
2.48k
                UInt32 to_scale = 0;
147
148
2.48k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
2.48k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
2.48k
                    const auto* to_decimal_type =
152
2.48k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
2.48k
                    to_precision = to_decimal_type->get_precision();
154
2.48k
                    ToDataType::check_type_precision(to_precision);
155
156
2.48k
                    to_scale = to_decimal_type->get_scale();
157
2.48k
                    ToDataType::check_type_scale(to_scale);
158
2.48k
                }
159
2.48k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
2.48k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
2.48k
                    to_precision = to_max_digits;
162
2.48k
                }
163
164
2.48k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2.48k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2.48k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2.48k
                if (to_scale > from_scale) {
169
2.48k
                    multiply_may_overflow &=
170
2.48k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
2.48k
                }
172
2.48k
                return narrow_integral || multiply_may_overflow;
173
2.48k
            }
174
2.48k
            return false;
175
2.48k
        });
176
2.48k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
112
10.2k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
10.2k
        using Types = std::decay_t<decltype(types)>;
114
10.2k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
10.2k
        return call_on_index_and_data_type<
122
10.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
10.2k
            using Types2 = std::decay_t<decltype(types2)>;
124
10.2k
            using FromDataType = typename Types2::LeftType;
125
10.2k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
10.2k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
10.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
10.2k
                return false;
129
10.2k
            }
130
10.2k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
10.2k
                using FromFieldType = typename FromDataType::FieldType;
132
10.2k
                using ToFieldType = typename ToDataType::FieldType;
133
10.2k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
10.2k
                UInt32 from_scale = 0;
135
136
10.2k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
10.2k
                    const auto* from_decimal_type =
138
10.2k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
10.2k
                    from_precision =
140
10.2k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
10.2k
                    from_scale = from_decimal_type->get_scale();
142
10.2k
                }
143
144
10.2k
                UInt32 to_max_digits = 0;
145
10.2k
                UInt32 to_precision = 0;
146
10.2k
                UInt32 to_scale = 0;
147
148
10.2k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
10.2k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
10.2k
                    const auto* to_decimal_type =
152
10.2k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
10.2k
                    to_precision = to_decimal_type->get_precision();
154
10.2k
                    ToDataType::check_type_precision(to_precision);
155
156
10.2k
                    to_scale = to_decimal_type->get_scale();
157
10.2k
                    ToDataType::check_type_scale(to_scale);
158
10.2k
                }
159
10.2k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
10.2k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
10.2k
                    to_precision = to_max_digits;
162
10.2k
                }
163
164
10.2k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
10.2k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
10.2k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
10.2k
                if (to_scale > from_scale) {
169
10.2k
                    multiply_may_overflow &=
170
10.2k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
10.2k
                }
172
10.2k
                return narrow_integral || multiply_may_overflow;
173
10.2k
            }
174
10.2k
            return false;
175
10.2k
        });
176
10.2k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
112
5.52k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
5.52k
        using Types = std::decay_t<decltype(types)>;
114
5.52k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
5.52k
        return call_on_index_and_data_type<
122
5.52k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
5.52k
            using Types2 = std::decay_t<decltype(types2)>;
124
5.52k
            using FromDataType = typename Types2::LeftType;
125
5.52k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
5.52k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
5.52k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
5.52k
                return false;
129
5.52k
            }
130
5.52k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
5.52k
                using FromFieldType = typename FromDataType::FieldType;
132
5.52k
                using ToFieldType = typename ToDataType::FieldType;
133
5.52k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
5.52k
                UInt32 from_scale = 0;
135
136
5.52k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
5.52k
                    const auto* from_decimal_type =
138
5.52k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
5.52k
                    from_precision =
140
5.52k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
5.52k
                    from_scale = from_decimal_type->get_scale();
142
5.52k
                }
143
144
5.52k
                UInt32 to_max_digits = 0;
145
5.52k
                UInt32 to_precision = 0;
146
5.52k
                UInt32 to_scale = 0;
147
148
5.52k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
5.52k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
5.52k
                    const auto* to_decimal_type =
152
5.52k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
5.52k
                    to_precision = to_decimal_type->get_precision();
154
5.52k
                    ToDataType::check_type_precision(to_precision);
155
156
5.52k
                    to_scale = to_decimal_type->get_scale();
157
5.52k
                    ToDataType::check_type_scale(to_scale);
158
5.52k
                }
159
5.52k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
5.52k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
5.52k
                    to_precision = to_max_digits;
162
5.52k
                }
163
164
5.52k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
5.52k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
5.52k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
5.52k
                if (to_scale > from_scale) {
169
5.52k
                    multiply_may_overflow &=
170
5.52k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
5.52k
                }
172
5.52k
                return narrow_integral || multiply_may_overflow;
173
5.52k
            }
174
5.52k
            return false;
175
5.52k
        });
176
5.52k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
112
174k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
174k
        using Types = std::decay_t<decltype(types)>;
114
174k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
174k
        return call_on_index_and_data_type<
122
174k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
174k
            using Types2 = std::decay_t<decltype(types2)>;
124
174k
            using FromDataType = typename Types2::LeftType;
125
174k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
174k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
174k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
174k
                return false;
129
174k
            }
130
174k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
174k
                using FromFieldType = typename FromDataType::FieldType;
132
174k
                using ToFieldType = typename ToDataType::FieldType;
133
174k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
174k
                UInt32 from_scale = 0;
135
136
174k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
174k
                    const auto* from_decimal_type =
138
174k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
174k
                    from_precision =
140
174k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
174k
                    from_scale = from_decimal_type->get_scale();
142
174k
                }
143
144
174k
                UInt32 to_max_digits = 0;
145
174k
                UInt32 to_precision = 0;
146
174k
                UInt32 to_scale = 0;
147
148
174k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
174k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
174k
                    const auto* to_decimal_type =
152
174k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
174k
                    to_precision = to_decimal_type->get_precision();
154
174k
                    ToDataType::check_type_precision(to_precision);
155
156
174k
                    to_scale = to_decimal_type->get_scale();
157
174k
                    ToDataType::check_type_scale(to_scale);
158
174k
                }
159
174k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
174k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
174k
                    to_precision = to_max_digits;
162
174k
                }
163
164
174k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
174k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
174k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
174k
                if (to_scale > from_scale) {
169
174k
                    multiply_may_overflow &=
170
174k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
174k
                }
172
174k
                return narrow_integral || multiply_may_overflow;
173
174k
            }
174
174k
            return false;
175
174k
        });
176
174k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
112
48.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
48.9k
        using Types = std::decay_t<decltype(types)>;
114
48.9k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
48.9k
        return call_on_index_and_data_type<
122
48.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
48.9k
            using Types2 = std::decay_t<decltype(types2)>;
124
48.9k
            using FromDataType = typename Types2::LeftType;
125
48.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
48.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
48.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
48.9k
                return false;
129
48.9k
            }
130
48.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
48.9k
                using FromFieldType = typename FromDataType::FieldType;
132
48.9k
                using ToFieldType = typename ToDataType::FieldType;
133
48.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
48.9k
                UInt32 from_scale = 0;
135
136
48.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
48.9k
                    const auto* from_decimal_type =
138
48.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
48.9k
                    from_precision =
140
48.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
48.9k
                    from_scale = from_decimal_type->get_scale();
142
48.9k
                }
143
144
48.9k
                UInt32 to_max_digits = 0;
145
48.9k
                UInt32 to_precision = 0;
146
48.9k
                UInt32 to_scale = 0;
147
148
48.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
48.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
48.9k
                    const auto* to_decimal_type =
152
48.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
48.9k
                    to_precision = to_decimal_type->get_precision();
154
48.9k
                    ToDataType::check_type_precision(to_precision);
155
156
48.9k
                    to_scale = to_decimal_type->get_scale();
157
48.9k
                    ToDataType::check_type_scale(to_scale);
158
48.9k
                }
159
48.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
48.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
48.9k
                    to_precision = to_max_digits;
162
48.9k
                }
163
164
48.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
48.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
48.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
48.9k
                if (to_scale > from_scale) {
169
48.9k
                    multiply_may_overflow &=
170
48.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
48.9k
                }
172
48.9k
                return narrow_integral || multiply_may_overflow;
173
48.9k
            }
174
48.9k
            return false;
175
48.9k
        });
176
48.9k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
112
80.3k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
80.3k
        using Types = std::decay_t<decltype(types)>;
114
80.3k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
80.3k
        return call_on_index_and_data_type<
122
80.3k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
80.3k
            using Types2 = std::decay_t<decltype(types2)>;
124
80.3k
            using FromDataType = typename Types2::LeftType;
125
80.3k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
80.3k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
80.3k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
80.3k
                return false;
129
80.3k
            }
130
80.3k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
80.3k
                using FromFieldType = typename FromDataType::FieldType;
132
80.3k
                using ToFieldType = typename ToDataType::FieldType;
133
80.3k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
80.3k
                UInt32 from_scale = 0;
135
136
80.3k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
80.3k
                    const auto* from_decimal_type =
138
80.3k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
80.3k
                    from_precision =
140
80.3k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
80.3k
                    from_scale = from_decimal_type->get_scale();
142
80.3k
                }
143
144
80.3k
                UInt32 to_max_digits = 0;
145
80.3k
                UInt32 to_precision = 0;
146
80.3k
                UInt32 to_scale = 0;
147
148
80.3k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
80.3k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
80.3k
                    const auto* to_decimal_type =
152
80.3k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
80.3k
                    to_precision = to_decimal_type->get_precision();
154
80.3k
                    ToDataType::check_type_precision(to_precision);
155
156
80.3k
                    to_scale = to_decimal_type->get_scale();
157
80.3k
                    ToDataType::check_type_scale(to_scale);
158
80.3k
                }
159
80.3k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
80.3k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
80.3k
                    to_precision = to_max_digits;
162
80.3k
                }
163
164
80.3k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
80.3k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
80.3k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
80.3k
                if (to_scale > from_scale) {
169
80.3k
                    multiply_may_overflow &=
170
80.3k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
80.3k
                }
172
80.3k
                return narrow_integral || multiply_may_overflow;
173
80.3k
            }
174
80.3k
            return false;
175
80.3k
        });
176
80.3k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
112
10.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
10.9k
        using Types = std::decay_t<decltype(types)>;
114
10.9k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
10.9k
        return call_on_index_and_data_type<
122
10.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
10.9k
            using Types2 = std::decay_t<decltype(types2)>;
124
10.9k
            using FromDataType = typename Types2::LeftType;
125
10.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
10.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
10.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
10.9k
                return false;
129
10.9k
            }
130
10.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
10.9k
                using FromFieldType = typename FromDataType::FieldType;
132
10.9k
                using ToFieldType = typename ToDataType::FieldType;
133
10.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
10.9k
                UInt32 from_scale = 0;
135
136
10.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
10.9k
                    const auto* from_decimal_type =
138
10.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
10.9k
                    from_precision =
140
10.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
10.9k
                    from_scale = from_decimal_type->get_scale();
142
10.9k
                }
143
144
10.9k
                UInt32 to_max_digits = 0;
145
10.9k
                UInt32 to_precision = 0;
146
10.9k
                UInt32 to_scale = 0;
147
148
10.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
10.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
10.9k
                    const auto* to_decimal_type =
152
10.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
10.9k
                    to_precision = to_decimal_type->get_precision();
154
10.9k
                    ToDataType::check_type_precision(to_precision);
155
156
10.9k
                    to_scale = to_decimal_type->get_scale();
157
10.9k
                    ToDataType::check_type_scale(to_scale);
158
10.9k
                }
159
10.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
10.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
10.9k
                    to_precision = to_max_digits;
162
10.9k
                }
163
164
10.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
10.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
10.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
10.9k
                if (to_scale > from_scale) {
169
10.9k
                    multiply_may_overflow &=
170
10.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
10.9k
                }
172
10.9k
                return narrow_integral || multiply_may_overflow;
173
10.9k
            }
174
10.9k
            return false;
175
10.9k
        });
176
10.9k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
112
28.4k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
28.4k
        using Types = std::decay_t<decltype(types)>;
114
28.4k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
28.4k
        return call_on_index_and_data_type<
122
28.4k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
28.4k
            using Types2 = std::decay_t<decltype(types2)>;
124
28.4k
            using FromDataType = typename Types2::LeftType;
125
28.4k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
28.4k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
28.4k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
28.4k
                return false;
129
28.4k
            }
130
28.4k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
28.4k
                using FromFieldType = typename FromDataType::FieldType;
132
28.4k
                using ToFieldType = typename ToDataType::FieldType;
133
28.4k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
28.4k
                UInt32 from_scale = 0;
135
136
28.4k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
28.4k
                    const auto* from_decimal_type =
138
28.4k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
28.4k
                    from_precision =
140
28.4k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
28.4k
                    from_scale = from_decimal_type->get_scale();
142
28.4k
                }
143
144
28.4k
                UInt32 to_max_digits = 0;
145
28.4k
                UInt32 to_precision = 0;
146
28.4k
                UInt32 to_scale = 0;
147
148
28.4k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
28.4k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
28.4k
                    const auto* to_decimal_type =
152
28.4k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
28.4k
                    to_precision = to_decimal_type->get_precision();
154
28.4k
                    ToDataType::check_type_precision(to_precision);
155
156
28.4k
                    to_scale = to_decimal_type->get_scale();
157
28.4k
                    ToDataType::check_type_scale(to_scale);
158
28.4k
                }
159
28.4k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
28.4k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
28.4k
                    to_precision = to_max_digits;
162
28.4k
                }
163
164
28.4k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
28.4k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
28.4k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
28.4k
                if (to_scale > from_scale) {
169
28.4k
                    multiply_may_overflow &=
170
28.4k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
28.4k
                }
172
28.4k
                return narrow_integral || multiply_may_overflow;
173
28.4k
            }
174
28.4k
            return false;
175
28.4k
        });
176
28.4k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
112
11.8k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
11.8k
        using Types = std::decay_t<decltype(types)>;
114
11.8k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
11.8k
        return call_on_index_and_data_type<
122
11.8k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
11.8k
            using Types2 = std::decay_t<decltype(types2)>;
124
11.8k
            using FromDataType = typename Types2::LeftType;
125
11.8k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
11.8k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
11.8k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
11.8k
                return false;
129
11.8k
            }
130
11.8k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
11.8k
                using FromFieldType = typename FromDataType::FieldType;
132
11.8k
                using ToFieldType = typename ToDataType::FieldType;
133
11.8k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
11.8k
                UInt32 from_scale = 0;
135
136
11.8k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
11.8k
                    const auto* from_decimal_type =
138
11.8k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
11.8k
                    from_precision =
140
11.8k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
11.8k
                    from_scale = from_decimal_type->get_scale();
142
11.8k
                }
143
144
11.8k
                UInt32 to_max_digits = 0;
145
11.8k
                UInt32 to_precision = 0;
146
11.8k
                UInt32 to_scale = 0;
147
148
11.8k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
11.8k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
11.8k
                    const auto* to_decimal_type =
152
11.8k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
11.8k
                    to_precision = to_decimal_type->get_precision();
154
11.8k
                    ToDataType::check_type_precision(to_precision);
155
156
11.8k
                    to_scale = to_decimal_type->get_scale();
157
11.8k
                    ToDataType::check_type_scale(to_scale);
158
11.8k
                }
159
11.8k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
11.8k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
11.8k
                    to_precision = to_max_digits;
162
11.8k
                }
163
164
11.8k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
11.8k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
11.8k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
11.8k
                if (to_scale > from_scale) {
169
11.8k
                    multiply_may_overflow &=
170
11.8k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
11.8k
                }
172
11.8k
                return narrow_integral || multiply_may_overflow;
173
11.8k
            }
174
11.8k
            return false;
175
11.8k
        });
176
11.8k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
112
31.2k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
31.2k
        using Types = std::decay_t<decltype(types)>;
114
31.2k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
31.2k
        return call_on_index_and_data_type<
122
31.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
31.2k
            using Types2 = std::decay_t<decltype(types2)>;
124
31.2k
            using FromDataType = typename Types2::LeftType;
125
31.2k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
31.2k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
31.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
31.2k
                return false;
129
31.2k
            }
130
31.2k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
31.2k
                using FromFieldType = typename FromDataType::FieldType;
132
31.2k
                using ToFieldType = typename ToDataType::FieldType;
133
31.2k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
31.2k
                UInt32 from_scale = 0;
135
136
31.2k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
31.2k
                    const auto* from_decimal_type =
138
31.2k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
31.2k
                    from_precision =
140
31.2k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
31.2k
                    from_scale = from_decimal_type->get_scale();
142
31.2k
                }
143
144
31.2k
                UInt32 to_max_digits = 0;
145
31.2k
                UInt32 to_precision = 0;
146
31.2k
                UInt32 to_scale = 0;
147
148
31.2k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
31.2k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
31.2k
                    const auto* to_decimal_type =
152
31.2k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
31.2k
                    to_precision = to_decimal_type->get_precision();
154
31.2k
                    ToDataType::check_type_precision(to_precision);
155
156
31.2k
                    to_scale = to_decimal_type->get_scale();
157
31.2k
                    ToDataType::check_type_scale(to_scale);
158
31.2k
                }
159
31.2k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
31.2k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
31.2k
                    to_precision = to_max_digits;
162
31.2k
                }
163
164
31.2k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
31.2k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
31.2k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
31.2k
                if (to_scale > from_scale) {
169
31.2k
                    multiply_may_overflow &=
170
31.2k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
31.2k
                }
172
31.2k
                return narrow_integral || multiply_may_overflow;
173
31.2k
            }
174
31.2k
            return false;
175
31.2k
        });
176
31.2k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
112
229
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
229
        using Types = std::decay_t<decltype(types)>;
114
229
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
229
        return call_on_index_and_data_type<
122
229
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
229
            using Types2 = std::decay_t<decltype(types2)>;
124
229
            using FromDataType = typename Types2::LeftType;
125
229
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
229
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
229
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
229
                return false;
129
229
            }
130
229
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
229
                using FromFieldType = typename FromDataType::FieldType;
132
229
                using ToFieldType = typename ToDataType::FieldType;
133
229
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
229
                UInt32 from_scale = 0;
135
136
229
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
229
                    const auto* from_decimal_type =
138
229
                            check_and_get_data_type<FromDataType>(from_type.get());
139
229
                    from_precision =
140
229
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
229
                    from_scale = from_decimal_type->get_scale();
142
229
                }
143
144
229
                UInt32 to_max_digits = 0;
145
229
                UInt32 to_precision = 0;
146
229
                UInt32 to_scale = 0;
147
148
229
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
229
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
229
                    const auto* to_decimal_type =
152
229
                            check_and_get_data_type<ToDataType>(to_type.get());
153
229
                    to_precision = to_decimal_type->get_precision();
154
229
                    ToDataType::check_type_precision(to_precision);
155
156
229
                    to_scale = to_decimal_type->get_scale();
157
229
                    ToDataType::check_type_scale(to_scale);
158
229
                }
159
229
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
229
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
229
                    to_precision = to_max_digits;
162
229
                }
163
164
229
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
229
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
229
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
229
                if (to_scale > from_scale) {
169
229
                    multiply_may_overflow &=
170
229
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
229
                }
172
229
                return narrow_integral || multiply_may_overflow;
173
229
            }
174
229
            return false;
175
229
        });
176
229
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
112
186k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
186k
        using Types = std::decay_t<decltype(types)>;
114
186k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
186k
        return call_on_index_and_data_type<
122
186k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
186k
            using Types2 = std::decay_t<decltype(types2)>;
124
186k
            using FromDataType = typename Types2::LeftType;
125
186k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
186k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
186k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
186k
                return false;
129
186k
            }
130
186k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
186k
                using FromFieldType = typename FromDataType::FieldType;
132
186k
                using ToFieldType = typename ToDataType::FieldType;
133
186k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
186k
                UInt32 from_scale = 0;
135
136
186k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
186k
                    const auto* from_decimal_type =
138
186k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
186k
                    from_precision =
140
186k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
186k
                    from_scale = from_decimal_type->get_scale();
142
186k
                }
143
144
186k
                UInt32 to_max_digits = 0;
145
186k
                UInt32 to_precision = 0;
146
186k
                UInt32 to_scale = 0;
147
148
186k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
186k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
186k
                    const auto* to_decimal_type =
152
186k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
186k
                    to_precision = to_decimal_type->get_precision();
154
186k
                    ToDataType::check_type_precision(to_precision);
155
156
186k
                    to_scale = to_decimal_type->get_scale();
157
186k
                    ToDataType::check_type_scale(to_scale);
158
186k
                }
159
186k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
186k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
186k
                    to_precision = to_max_digits;
162
186k
                }
163
164
186k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
186k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
186k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
186k
                if (to_scale > from_scale) {
169
186k
                    multiply_may_overflow &=
170
186k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
186k
                }
172
186k
                return narrow_integral || multiply_may_overflow;
173
186k
            }
174
186k
            return false;
175
186k
        });
176
186k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_
Line
Count
Source
112
10.8k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
10.8k
        using Types = std::decay_t<decltype(types)>;
114
10.8k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
10.8k
        return call_on_index_and_data_type<
122
10.8k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
10.8k
            using Types2 = std::decay_t<decltype(types2)>;
124
10.8k
            using FromDataType = typename Types2::LeftType;
125
10.8k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
10.8k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
10.8k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
10.8k
                return false;
129
10.8k
            }
130
10.8k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
10.8k
                using FromFieldType = typename FromDataType::FieldType;
132
10.8k
                using ToFieldType = typename ToDataType::FieldType;
133
10.8k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
10.8k
                UInt32 from_scale = 0;
135
136
10.8k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
10.8k
                    const auto* from_decimal_type =
138
10.8k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
10.8k
                    from_precision =
140
10.8k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
10.8k
                    from_scale = from_decimal_type->get_scale();
142
10.8k
                }
143
144
10.8k
                UInt32 to_max_digits = 0;
145
10.8k
                UInt32 to_precision = 0;
146
10.8k
                UInt32 to_scale = 0;
147
148
10.8k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
10.8k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
10.8k
                    const auto* to_decimal_type =
152
10.8k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
10.8k
                    to_precision = to_decimal_type->get_precision();
154
10.8k
                    ToDataType::check_type_precision(to_precision);
155
156
10.8k
                    to_scale = to_decimal_type->get_scale();
157
10.8k
                    ToDataType::check_type_scale(to_scale);
158
10.8k
                }
159
10.8k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
10.8k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
10.8k
                    to_precision = to_max_digits;
162
10.8k
                }
163
164
10.8k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
10.8k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
10.8k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
10.8k
                if (to_scale > from_scale) {
169
10.8k
                    multiply_may_overflow &=
170
10.8k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
10.8k
                }
172
10.8k
                return narrow_integral || multiply_may_overflow;
173
10.8k
            }
174
10.8k
            return false;
175
10.8k
        });
176
10.8k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_
Line
Count
Source
112
32
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
32
        using Types = std::decay_t<decltype(types)>;
114
32
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
32
        return call_on_index_and_data_type<
122
32
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
32
            using Types2 = std::decay_t<decltype(types2)>;
124
32
            using FromDataType = typename Types2::LeftType;
125
32
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
32
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
32
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
32
                return false;
129
32
            }
130
32
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
32
                using FromFieldType = typename FromDataType::FieldType;
132
32
                using ToFieldType = typename ToDataType::FieldType;
133
32
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
32
                UInt32 from_scale = 0;
135
136
32
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
32
                    const auto* from_decimal_type =
138
32
                            check_and_get_data_type<FromDataType>(from_type.get());
139
32
                    from_precision =
140
32
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
32
                    from_scale = from_decimal_type->get_scale();
142
32
                }
143
144
32
                UInt32 to_max_digits = 0;
145
32
                UInt32 to_precision = 0;
146
32
                UInt32 to_scale = 0;
147
148
32
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
32
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
32
                    const auto* to_decimal_type =
152
32
                            check_and_get_data_type<ToDataType>(to_type.get());
153
32
                    to_precision = to_decimal_type->get_precision();
154
32
                    ToDataType::check_type_precision(to_precision);
155
156
32
                    to_scale = to_decimal_type->get_scale();
157
32
                    ToDataType::check_type_scale(to_scale);
158
32
                }
159
32
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
32
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
32
                    to_precision = to_max_digits;
162
32
                }
163
164
32
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
32
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
32
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
32
                if (to_scale > from_scale) {
169
32
                    multiply_may_overflow &=
170
32
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
32
                }
172
32
                return narrow_integral || multiply_may_overflow;
173
32
            }
174
32
            return false;
175
32
        });
176
32
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_
Line
Count
Source
112
177k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
177k
        using Types = std::decay_t<decltype(types)>;
114
177k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
177k
        return call_on_index_and_data_type<
122
177k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
177k
            using Types2 = std::decay_t<decltype(types2)>;
124
177k
            using FromDataType = typename Types2::LeftType;
125
177k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
177k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
177k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
177k
                return false;
129
177k
            }
130
177k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
177k
                using FromFieldType = typename FromDataType::FieldType;
132
177k
                using ToFieldType = typename ToDataType::FieldType;
133
177k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
177k
                UInt32 from_scale = 0;
135
136
177k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
177k
                    const auto* from_decimal_type =
138
177k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
177k
                    from_precision =
140
177k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
177k
                    from_scale = from_decimal_type->get_scale();
142
177k
                }
143
144
177k
                UInt32 to_max_digits = 0;
145
177k
                UInt32 to_precision = 0;
146
177k
                UInt32 to_scale = 0;
147
148
177k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
177k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
177k
                    const auto* to_decimal_type =
152
177k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
177k
                    to_precision = to_decimal_type->get_precision();
154
177k
                    ToDataType::check_type_precision(to_precision);
155
156
177k
                    to_scale = to_decimal_type->get_scale();
157
177k
                    ToDataType::check_type_scale(to_scale);
158
177k
                }
159
177k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
177k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
177k
                    to_precision = to_max_digits;
162
177k
                }
163
164
177k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
177k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
177k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
177k
                if (to_scale > from_scale) {
169
177k
                    multiply_may_overflow &=
170
177k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
177k
                }
172
177k
                return narrow_integral || multiply_may_overflow;
173
177k
            }
174
177k
            return false;
175
177k
        });
176
177k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
112
170k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
170k
        using Types = std::decay_t<decltype(types)>;
114
170k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
170k
        return call_on_index_and_data_type<
122
170k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
170k
            using Types2 = std::decay_t<decltype(types2)>;
124
170k
            using FromDataType = typename Types2::LeftType;
125
170k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
170k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
170k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
170k
                return false;
129
170k
            }
130
170k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
170k
                using FromFieldType = typename FromDataType::FieldType;
132
170k
                using ToFieldType = typename ToDataType::FieldType;
133
170k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
170k
                UInt32 from_scale = 0;
135
136
170k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
170k
                    const auto* from_decimal_type =
138
170k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
170k
                    from_precision =
140
170k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
170k
                    from_scale = from_decimal_type->get_scale();
142
170k
                }
143
144
170k
                UInt32 to_max_digits = 0;
145
170k
                UInt32 to_precision = 0;
146
170k
                UInt32 to_scale = 0;
147
148
170k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
170k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
170k
                    const auto* to_decimal_type =
152
170k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
170k
                    to_precision = to_decimal_type->get_precision();
154
170k
                    ToDataType::check_type_precision(to_precision);
155
156
170k
                    to_scale = to_decimal_type->get_scale();
157
170k
                    ToDataType::check_type_scale(to_scale);
158
170k
                }
159
170k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
170k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
170k
                    to_precision = to_max_digits;
162
170k
                }
163
164
170k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
170k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
170k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
170k
                if (to_scale > from_scale) {
169
170k
                    multiply_may_overflow &=
170
170k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
170k
                }
172
170k
                return narrow_integral || multiply_may_overflow;
173
170k
            }
174
170k
            return false;
175
170k
        });
176
170k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_
Line
Count
Source
112
26
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
26
        using Types = std::decay_t<decltype(types)>;
114
26
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
26
        return call_on_index_and_data_type<
122
26
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
26
            using Types2 = std::decay_t<decltype(types2)>;
124
26
            using FromDataType = typename Types2::LeftType;
125
26
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
26
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
26
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
26
                return false;
129
26
            }
130
26
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
26
                using FromFieldType = typename FromDataType::FieldType;
132
26
                using ToFieldType = typename ToDataType::FieldType;
133
26
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
26
                UInt32 from_scale = 0;
135
136
26
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
26
                    const auto* from_decimal_type =
138
26
                            check_and_get_data_type<FromDataType>(from_type.get());
139
26
                    from_precision =
140
26
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
26
                    from_scale = from_decimal_type->get_scale();
142
26
                }
143
144
26
                UInt32 to_max_digits = 0;
145
26
                UInt32 to_precision = 0;
146
26
                UInt32 to_scale = 0;
147
148
26
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
26
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
26
                    const auto* to_decimal_type =
152
26
                            check_and_get_data_type<ToDataType>(to_type.get());
153
26
                    to_precision = to_decimal_type->get_precision();
154
26
                    ToDataType::check_type_precision(to_precision);
155
156
26
                    to_scale = to_decimal_type->get_scale();
157
26
                    ToDataType::check_type_scale(to_scale);
158
26
                }
159
26
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
26
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
26
                    to_precision = to_max_digits;
162
26
                }
163
164
26
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
26
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
26
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
26
                if (to_scale > from_scale) {
169
26
                    multiply_may_overflow &=
170
26
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
26
                }
172
26
                return narrow_integral || multiply_may_overflow;
173
26
            }
174
26
            return false;
175
26
        });
176
26
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_
Line
Count
Source
112
468
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
468
        using Types = std::decay_t<decltype(types)>;
114
468
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
468
        return call_on_index_and_data_type<
122
468
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
468
            using Types2 = std::decay_t<decltype(types2)>;
124
468
            using FromDataType = typename Types2::LeftType;
125
468
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
468
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
468
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
468
                return false;
129
468
            }
130
468
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
468
                using FromFieldType = typename FromDataType::FieldType;
132
468
                using ToFieldType = typename ToDataType::FieldType;
133
468
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
468
                UInt32 from_scale = 0;
135
136
468
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
468
                    const auto* from_decimal_type =
138
468
                            check_and_get_data_type<FromDataType>(from_type.get());
139
468
                    from_precision =
140
468
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
468
                    from_scale = from_decimal_type->get_scale();
142
468
                }
143
144
468
                UInt32 to_max_digits = 0;
145
468
                UInt32 to_precision = 0;
146
468
                UInt32 to_scale = 0;
147
148
468
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
468
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
468
                    const auto* to_decimal_type =
152
468
                            check_and_get_data_type<ToDataType>(to_type.get());
153
468
                    to_precision = to_decimal_type->get_precision();
154
468
                    ToDataType::check_type_precision(to_precision);
155
156
468
                    to_scale = to_decimal_type->get_scale();
157
468
                    ToDataType::check_type_scale(to_scale);
158
468
                }
159
468
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
468
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
468
                    to_precision = to_max_digits;
162
468
                }
163
164
468
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
468
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
468
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
468
                if (to_scale > from_scale) {
169
468
                    multiply_may_overflow &=
170
468
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
468
                }
172
468
                return narrow_integral || multiply_may_overflow;
173
468
            }
174
468
            return false;
175
468
        });
176
468
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_
Line
Count
Source
112
590
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
590
        using Types = std::decay_t<decltype(types)>;
114
590
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
590
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
590
            return false;
120
590
        }
121
0
        return call_on_index_and_data_type<
122
590
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
590
            using Types2 = std::decay_t<decltype(types2)>;
124
590
            using FromDataType = typename Types2::LeftType;
125
590
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
590
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
590
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
590
                return false;
129
590
            }
130
590
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
590
                using FromFieldType = typename FromDataType::FieldType;
132
590
                using ToFieldType = typename ToDataType::FieldType;
133
590
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
590
                UInt32 from_scale = 0;
135
136
590
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
590
                    const auto* from_decimal_type =
138
590
                            check_and_get_data_type<FromDataType>(from_type.get());
139
590
                    from_precision =
140
590
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
590
                    from_scale = from_decimal_type->get_scale();
142
590
                }
143
144
590
                UInt32 to_max_digits = 0;
145
590
                UInt32 to_precision = 0;
146
590
                UInt32 to_scale = 0;
147
148
590
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
590
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
590
                    const auto* to_decimal_type =
152
590
                            check_and_get_data_type<ToDataType>(to_type.get());
153
590
                    to_precision = to_decimal_type->get_precision();
154
590
                    ToDataType::check_type_precision(to_precision);
155
156
590
                    to_scale = to_decimal_type->get_scale();
157
590
                    ToDataType::check_type_scale(to_scale);
158
590
                }
159
590
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
590
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
590
                    to_precision = to_max_digits;
162
590
                }
163
164
590
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
590
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
590
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
590
                if (to_scale > from_scale) {
169
590
                    multiply_may_overflow &=
170
590
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
590
                }
172
590
                return narrow_integral || multiply_may_overflow;
173
590
            }
174
590
            return false;
175
590
        });
176
590
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_
Line
Count
Source
112
85.5k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
85.5k
        using Types = std::decay_t<decltype(types)>;
114
85.5k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
85.5k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
85.5k
            return false;
120
85.5k
        }
121
0
        return call_on_index_and_data_type<
122
85.5k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
85.5k
            using Types2 = std::decay_t<decltype(types2)>;
124
85.5k
            using FromDataType = typename Types2::LeftType;
125
85.5k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
85.5k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
85.5k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
85.5k
                return false;
129
85.5k
            }
130
85.5k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
85.5k
                using FromFieldType = typename FromDataType::FieldType;
132
85.5k
                using ToFieldType = typename ToDataType::FieldType;
133
85.5k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
85.5k
                UInt32 from_scale = 0;
135
136
85.5k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
85.5k
                    const auto* from_decimal_type =
138
85.5k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
85.5k
                    from_precision =
140
85.5k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
85.5k
                    from_scale = from_decimal_type->get_scale();
142
85.5k
                }
143
144
85.5k
                UInt32 to_max_digits = 0;
145
85.5k
                UInt32 to_precision = 0;
146
85.5k
                UInt32 to_scale = 0;
147
148
85.5k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
85.5k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
85.5k
                    const auto* to_decimal_type =
152
85.5k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
85.5k
                    to_precision = to_decimal_type->get_precision();
154
85.5k
                    ToDataType::check_type_precision(to_precision);
155
156
85.5k
                    to_scale = to_decimal_type->get_scale();
157
85.5k
                    ToDataType::check_type_scale(to_scale);
158
85.5k
                }
159
85.5k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
85.5k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
85.5k
                    to_precision = to_max_digits;
162
85.5k
                }
163
164
85.5k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
85.5k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
85.5k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
85.5k
                if (to_scale > from_scale) {
169
85.5k
                    multiply_may_overflow &=
170
85.5k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
85.5k
                }
172
85.5k
                return narrow_integral || multiply_may_overflow;
173
85.5k
            }
174
85.5k
            return false;
175
85.5k
        });
176
85.5k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_
Line
Count
Source
112
164k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
164k
        using Types = std::decay_t<decltype(types)>;
114
164k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
164k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
164k
            return false;
120
164k
        }
121
0
        return call_on_index_and_data_type<
122
164k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
164k
            using Types2 = std::decay_t<decltype(types2)>;
124
164k
            using FromDataType = typename Types2::LeftType;
125
164k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
164k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
164k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
164k
                return false;
129
164k
            }
130
164k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
164k
                using FromFieldType = typename FromDataType::FieldType;
132
164k
                using ToFieldType = typename ToDataType::FieldType;
133
164k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
164k
                UInt32 from_scale = 0;
135
136
164k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
164k
                    const auto* from_decimal_type =
138
164k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
164k
                    from_precision =
140
164k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
164k
                    from_scale = from_decimal_type->get_scale();
142
164k
                }
143
144
164k
                UInt32 to_max_digits = 0;
145
164k
                UInt32 to_precision = 0;
146
164k
                UInt32 to_scale = 0;
147
148
164k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
164k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
164k
                    const auto* to_decimal_type =
152
164k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
164k
                    to_precision = to_decimal_type->get_precision();
154
164k
                    ToDataType::check_type_precision(to_precision);
155
156
164k
                    to_scale = to_decimal_type->get_scale();
157
164k
                    ToDataType::check_type_scale(to_scale);
158
164k
                }
159
164k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
164k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
164k
                    to_precision = to_max_digits;
162
164k
                }
163
164
164k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
164k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
164k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
164k
                if (to_scale > from_scale) {
169
164k
                    multiply_may_overflow &=
170
164k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
164k
                }
172
164k
                return narrow_integral || multiply_may_overflow;
173
164k
            }
174
164k
            return false;
175
164k
        });
176
164k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_
Line
Count
Source
112
122k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
122k
        using Types = std::decay_t<decltype(types)>;
114
122k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
122k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
122k
            return false;
120
122k
        }
121
0
        return call_on_index_and_data_type<
122
122k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
122k
            using Types2 = std::decay_t<decltype(types2)>;
124
122k
            using FromDataType = typename Types2::LeftType;
125
122k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
122k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
122k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
122k
                return false;
129
122k
            }
130
122k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
122k
                using FromFieldType = typename FromDataType::FieldType;
132
122k
                using ToFieldType = typename ToDataType::FieldType;
133
122k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
122k
                UInt32 from_scale = 0;
135
136
122k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
122k
                    const auto* from_decimal_type =
138
122k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
122k
                    from_precision =
140
122k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
122k
                    from_scale = from_decimal_type->get_scale();
142
122k
                }
143
144
122k
                UInt32 to_max_digits = 0;
145
122k
                UInt32 to_precision = 0;
146
122k
                UInt32 to_scale = 0;
147
148
122k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
122k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
122k
                    const auto* to_decimal_type =
152
122k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
122k
                    to_precision = to_decimal_type->get_precision();
154
122k
                    ToDataType::check_type_precision(to_precision);
155
156
122k
                    to_scale = to_decimal_type->get_scale();
157
122k
                    ToDataType::check_type_scale(to_scale);
158
122k
                }
159
122k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
122k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
122k
                    to_precision = to_max_digits;
162
122k
                }
163
164
122k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
122k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
122k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
122k
                if (to_scale > from_scale) {
169
122k
                    multiply_may_overflow &=
170
122k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
122k
                }
172
122k
                return narrow_integral || multiply_may_overflow;
173
122k
            }
174
122k
            return false;
175
122k
        });
176
122k
    };
177
178
1.57M
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
179
1.66M
}
180
181
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
182
1.70M
                                    const DataTypePtr& to_type) {
183
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
184
1.70M
    bool result_is_nullable = to_type->is_nullable();
185
186
1.70M
    if (result_is_nullable) {
187
1.66M
        return [from_type, to_type](FunctionContext* context, Block& block,
188
1.66M
                                    const ColumnNumbers& arguments, uint32_t result,
189
1.66M
                                    size_t input_rows_count,
190
1.66M
                                    const NullMap::value_type* null_map = nullptr) {
191
1.66M
            auto from_type_not_nullable = remove_nullable(from_type);
192
1.66M
            auto to_type_not_nullable = remove_nullable(to_type);
193
194
1.66M
            bool replace_null_data_to_default = need_replace_null_data_to_default(
195
1.66M
                    context, from_type_not_nullable, to_type_not_nullable);
196
197
1.66M
            auto nested_result_index = block.columns();
198
1.66M
            block.insert(block.get_by_position(result).unnest_nullable());
199
1.66M
            auto nested_source_index = block.columns();
200
1.66M
            block.insert(block.get_by_position(arguments[0])
201
1.66M
                                 .unnest_nullable(replace_null_data_to_default));
202
203
1.66M
            const auto& arg_col = block.get_by_position(arguments[0]);
204
1.66M
            const NullMap::value_type* arg_null_map = nullptr;
205
1.66M
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
206
1.61M
                arg_null_map = nullable->get_null_map_data().data();
207
1.61M
            }
208
1.66M
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
209
1.66M
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
210
1.66M
                    arg_null_map));
211
212
1.63M
            block.get_by_position(result).column =
213
1.63M
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
214
1.63M
                                     arguments, input_rows_count);
215
216
1.63M
            block.erase(nested_source_index);
217
1.63M
            block.erase(nested_result_index);
218
1.63M
            return Status::OK();
219
1.66M
        };
220
1.66M
    } else {
221
42.2k
        return prepare_impl(context, from_type, to_type);
222
42.2k
    }
223
1.70M
}
224
225
/// 'from_type' and 'to_type' are nested types in case of Nullable.
226
/// 'requested_result_is_nullable' is true if CAST to Nullable type is requested.
227
WrapperType prepare_impl(FunctionContext* context, const DataTypePtr& origin_from_type,
228
1.71M
                         const DataTypePtr& origin_to_type) {
229
1.71M
    auto to_type = get_serialized_type(origin_to_type);
230
1.71M
    auto from_type = get_serialized_type(origin_from_type);
231
1.71M
    if (from_type->equals(*to_type)) {
232
98.2k
        return create_identity_wrapper(from_type);
233
98.2k
    }
234
235
1.62M
    const auto* from_variant =
236
1.62M
            dynamic_cast<const DataTypeVariant*>(remove_nullable(from_type).get());
237
1.62M
    const auto* to_variant = dynamic_cast<const DataTypeVariant*>(remove_nullable(to_type).get());
238
1.62M
    if (from_variant != nullptr && to_variant != nullptr &&
239
1.62M
        from_variant->is_variant_v2() != to_variant->is_variant_v2()) {
240
0
        return CastWrapper::create_unsupport_wrapper(
241
0
                "Cast between legacy Variant and compute-only Variant V2 is not supported");
242
0
    }
243
244
    // variant needs to be judged first
245
1.62M
    if (to_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
246
11.8k
        DORIS_CHECK(to_variant != nullptr);
247
11.8k
        if (to_variant->is_variant_v2()) {
248
0
            return create_cast_to_variant_v2_wrapper(from_type);
249
0
        }
250
11.8k
        return create_cast_to_variant_wrapper(from_type, *to_variant);
251
11.8k
    }
252
1.60M
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
253
16.1k
        DORIS_CHECK(from_variant != nullptr);
254
16.1k
        if (from_variant->is_variant_v2()) {
255
0
            auto wrapper = create_cast_from_variant_v2_wrapper(to_type);
256
0
            return [wrapper = std::move(wrapper)](
257
0
                           FunctionContext* context, Block& block, const ColumnNumbers& arguments,
258
0
                           uint32_t result, size_t rows, const NullMap::value_type* null_map) {
259
0
                RETURN_IF_ERROR(wrapper(context, block, arguments, result, rows, null_map));
260
0
                auto& result_column = block.get_by_position(result).column;
261
0
                if (null_map == nullptr) {
262
0
                    const auto* nullable = check_and_get_column<ColumnNullable>(*result_column);
263
0
                    if (nullable != nullptr && !nullable->has_null()) {
264
0
                        result_column = nullable->get_nested_column_ptr();
265
0
                    }
266
0
                }
267
0
                return Status::OK();
268
0
            };
269
0
        }
270
16.1k
        return create_cast_from_variant_wrapper(*from_variant, to_type);
271
16.1k
    }
272
273
1.59M
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
274
9.27k
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
275
9.27k
                                              to_type,
276
18.4E
                                              context ? context->jsonb_string_as_string() : false);
277
9.27k
    }
278
279
1.58M
    switch (to_type->get_primitive_type()) {
280
1.10k
    case PrimitiveType::TYPE_BOOLEAN:
281
1.10k
        return create_boolean_wrapper(context, from_type);
282
10.3k
    case PrimitiveType::TYPE_TINYINT:
283
15.8k
    case PrimitiveType::TYPE_SMALLINT:
284
188k
    case PrimitiveType::TYPE_INT:
285
242k
    case PrimitiveType::TYPE_BIGINT:
286
322k
    case PrimitiveType::TYPE_LARGEINT:
287
322k
        return create_int_wrapper(context, from_type, to_type->get_primitive_type());
288
11.0k
    case PrimitiveType::TYPE_FLOAT:
289
42.9k
    case PrimitiveType::TYPE_DOUBLE:
290
42.9k
        return create_float_wrapper(context, from_type, to_type->get_primitive_type());
291
32
    case PrimitiveType::TYPE_DATE:
292
58
    case PrimitiveType::TYPE_DATETIME:
293
177k
    case PrimitiveType::TYPE_DATEV2:
294
347k
    case PrimitiveType::TYPE_DATETIMEV2:
295
348k
    case PrimitiveType::TYPE_TIMEV2:
296
348k
        return create_datelike_wrapper(context, from_type, to_type->get_primitive_type());
297
581
    case PrimitiveType::TYPE_TIMESTAMPTZ:
298
581
        return create_timestamptz_wrapper(context, from_type);
299
85.4k
    case PrimitiveType::TYPE_IPV4:
300
250k
    case PrimitiveType::TYPE_IPV6:
301
250k
        return create_ip_wrapper(context, from_type, to_type->get_primitive_type());
302
293
    case PrimitiveType::TYPE_DECIMALV2:
303
12.2k
    case PrimitiveType::TYPE_DECIMAL32:
304
46.5k
    case PrimitiveType::TYPE_DECIMAL64:
305
236k
    case PrimitiveType::TYPE_DECIMAL128I:
306
247k
    case PrimitiveType::TYPE_DECIMAL256:
307
247k
        return create_decimal_wrapper(context, from_type, to_type->get_primitive_type());
308
19
    case PrimitiveType::TYPE_CHAR:
309
10.1k
    case PrimitiveType::TYPE_VARCHAR:
310
131k
    case PrimitiveType::TYPE_STRING:
311
131k
        return create_string_wrapper(from_type);
312
172k
    case PrimitiveType::TYPE_ARRAY:
313
172k
        return create_array_wrapper(context, from_type,
314
172k
                                    static_cast<const DataTypeArray&>(*to_type));
315
3.55k
    case PrimitiveType::TYPE_STRUCT:
316
3.55k
        return create_struct_wrapper(context, from_type,
317
3.55k
                                     static_cast<const DataTypeStruct&>(*to_type));
318
3.44k
    case PrimitiveType::TYPE_MAP:
319
3.44k
        return create_map_wrapper(context, from_type, static_cast<const DataTypeMap&>(*to_type));
320
6
    case PrimitiveType::TYPE_HLL:
321
6
        return create_hll_wrapper(context, from_type, static_cast<const DataTypeHLL&>(*to_type));
322
5
    case PrimitiveType::TYPE_BITMAP:
323
5
        return create_bitmap_wrapper(context, from_type,
324
5
                                     static_cast<const DataTypeBitMap&>(*to_type));
325
2
    case PrimitiveType::TYPE_QUANTILE_STATE:
326
2
        return create_quantile_state_wrapper(context, from_type,
327
2
                                             static_cast<const DataTypeQuantileState&>(*to_type));
328
59.6k
    case PrimitiveType::TYPE_JSONB:
329
59.6k
        return create_cast_to_jsonb_wrapper(from_type, static_cast<const DataTypeJsonb&>(*to_type),
330
18.4E
                                            context ? context->string_as_jsonb_string() : false);
331
556
    case PrimitiveType::TYPE_VARBINARY:
332
556
        return create_varbinary_wrapper(from_type);
333
0
    default:
334
0
        break;
335
1.58M
    }
336
337
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
338
1.58M
}
339
340
} // namespace CastWrapper
341
342
class PreparedFunctionCast : public PreparedFunctionImpl {
343
public:
344
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
345
1.52M
            : wrapper_function(std::move(wrapper_function_)), name(name_) {}
346
347
0
    String get_name() const override { return name; }
348
349
protected:
350
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
351
1.52M
                        uint32_t result, size_t input_rows_count) const override {
352
1.52M
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
353
1.52M
    }
354
355
1.52M
    bool use_default_implementation_for_nulls() const override { return false; }
356
1.52M
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {1}; }
357
358
private:
359
    CastWrapper::WrapperType wrapper_function;
360
    const char* name;
361
};
362
363
class FunctionCast final : public IFunctionBase {
364
public:
365
    FunctionCast(const char* name_, DataTypes argument_types_, DataTypePtr return_type_)
366
1.41M
            : name(name_),
367
1.41M
              argument_types(std::move(argument_types_)),
368
1.41M
              return_type(std::move(return_type_)) {}
369
370
1.52M
    const DataTypes& get_argument_types() const override { return argument_types; }
371
1.52M
    const DataTypePtr& get_return_type() const override { return return_type; }
372
373
    PreparedFunctionPtr prepare(FunctionContext* context, const Block& /*sample_block*/,
374
                                const ColumnNumbers& /*arguments*/,
375
1.52M
                                uint32_t /*result*/) const override {
376
1.52M
        return std::make_shared<PreparedFunctionCast>(
377
1.52M
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
378
1.52M
                                                         get_return_type()),
379
1.52M
                name);
380
1.52M
    }
381
382
0
    String get_name() const override { return name; }
383
384
0
    bool is_use_default_implementation_for_constants() const override { return true; }
385
386
private:
387
    const char* name = nullptr;
388
389
    DataTypes argument_types;
390
    DataTypePtr return_type;
391
};
392
393
class FunctionBuilderCast : public FunctionBuilderImpl {
394
public:
395
    static constexpr auto name = "CAST";
396
1.41M
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
397
398
1.41M
    FunctionBuilderCast() = default;
399
400
1
    String get_name() const override { return name; }
401
402
0
    size_t get_number_of_arguments() const override { return 2; }
403
404
0
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {1}; }
405
406
protected:
407
    FunctionBasePtr build_impl(const ColumnsWithTypeAndName& arguments,
408
1.41M
                               const DataTypePtr& return_type) const override {
409
1.41M
        DataTypes data_types(arguments.size());
410
411
4.20M
        for (size_t i = 0; i < arguments.size(); ++i) {
412
2.79M
            data_types[i] = arguments[i].type;
413
2.79M
        }
414
415
1.41M
        return std::make_shared<FunctionCast>(name, data_types, return_type);
416
1.41M
    }
417
418
1.41M
    bool skip_return_type_check() const override { return true; }
419
0
    DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override {
420
0
        return nullptr;
421
0
    }
422
423
0
    bool use_default_implementation_for_nulls() const override { return false; }
424
};
425
426
8
void register_function_cast(SimpleFunctionFactory& factory) {
427
8
    factory.register_function<FunctionBuilderCast>();
428
8
}
429
} // namespace doris