Coverage Report

Created: 2026-07-30 17:55

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/data_type_variant_v2.h"
26
#include "core/data_type/primitive_type.h"
27
#include "exprs/function/cast/cast_to_array.h"
28
#include "exprs/function/cast/cast_to_jsonb.h"
29
#include "exprs/function/cast/cast_to_map.h"
30
#include "exprs/function/cast/cast_to_struct.h"
31
#include "exprs/function/cast/cast_to_variant.h"
32
#include "exprs/function/cast/cast_wrapper_decls.h"
33
#include "exprs/function/cast/variant_v2/cast_variant_v2.h"
34
#include "exprs/function/simple_function_factory.h"
35
36
namespace doris {
37
38
namespace CastWrapper {
39
40
WrapperType create_hll_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
41
0
                               const DataTypeHLL& to_type) {
42
    /// Conversion from String through parsing.
43
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
44
0
        return cast_from_string_to_generic;
45
0
    }
46
47
0
    return CastWrapper::create_unsupport_wrapper("Cast to HLL only support from String type");
48
0
}
49
50
WrapperType create_bitmap_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
51
0
                                  const DataTypeBitMap& to_type) {
52
    /// Conversion from String through parsing.
53
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
54
0
        return cast_from_string_to_generic;
55
0
    }
56
57
0
    return CastWrapper::create_unsupport_wrapper("Cast to BitMap only support from String type");
58
0
}
59
60
WrapperType create_quantile_state_wrapper(FunctionContext* context,
61
                                          const DataTypePtr& from_type_untyped,
62
0
                                          const DataTypeQuantileState& to_type) {
63
    /// Conversion from String through parsing.
64
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
65
0
        return cast_from_string_to_generic;
66
0
    }
67
68
0
    return CastWrapper::create_unsupport_wrapper(
69
0
            "Cast to QuantileState only support from String type");
70
0
}
71
72
0
WrapperType create_varbinary_wrapper(const DataTypePtr& from_type_untyped) {
73
    /// Conversion from String through parsing.
74
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
75
0
        return cast_from_string_to_generic;
76
0
    }
77
78
0
    return CastWrapper::create_unsupport_wrapper("Cast to Varbinary only support from String type");
79
0
}
80
81
WrapperType prepare_unpack_dictionaries(FunctionContext* context, const DataTypePtr& from_type,
82
85.4k
                                        const DataTypePtr& to_type) {
83
85.4k
    const auto& from_nested = from_type;
84
85.4k
    const auto& to_nested = to_type;
85
86
85.4k
    if (from_type->is_null_literal()) {
87
2
        if (!to_nested->is_nullable()) {
88
0
            return CastWrapper::create_unsupport_wrapper(
89
0
                    "Cannot convert NULL to a non-nullable type");
90
0
        }
91
92
2
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
93
2
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
94
            /// TODO: remove this in the future.
95
2
            auto& res = block.get_by_position(result);
96
2
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
97
2
                                 ->convert_to_full_column_if_const();
98
2
            return Status::OK();
99
2
        };
100
2
    }
101
102
85.4k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
103
104
85.4k
    return wrapper;
105
85.4k
}
106
107
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
108
85.4k
                                       const DataTypePtr& to_type) {
109
85.4k
    if (from_type->equals(*to_type)) {
110
132
        return false;
111
132
    }
112
113
85.2k
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
35.3k
        using Types = std::decay_t<decltype(types)>;
115
35.3k
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
63
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
63
            return false;
121
63
        }
122
0
        return call_on_index_and_data_type<
123
35.3k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
35.1k
            using Types2 = std::decay_t<decltype(types2)>;
125
35.1k
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
10.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
10.2k
                return false;
130
10.2k
            }
131
12.8k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
12.8k
                using FromFieldType = typename FromDataType::FieldType;
133
12.8k
                using ToFieldType = typename ToDataType::FieldType;
134
12.8k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
12.8k
                UInt32 from_scale = 0;
136
137
12.8k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
5.46k
                    const auto* from_decimal_type =
139
5.46k
                            check_and_get_data_type<FromDataType>(from_type.get());
140
5.46k
                    from_precision =
141
5.46k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
5.46k
                    from_scale = from_decimal_type->get_scale();
143
5.46k
                }
144
145
12.8k
                UInt32 to_max_digits = 0;
146
12.8k
                UInt32 to_precision = 0;
147
12.8k
                UInt32 to_scale = 0;
148
149
12.8k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
12.3k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
12.3k
                    const auto* to_decimal_type =
153
12.3k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
12.3k
                    to_precision = to_decimal_type->get_precision();
155
12.3k
                    ToDataType::check_type_precision(to_precision);
156
157
12.3k
                    to_scale = to_decimal_type->get_scale();
158
12.3k
                    ToDataType::check_type_scale(to_scale);
159
12.3k
                }
160
12.8k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
577
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
577
                    to_precision = to_max_digits;
163
577
                }
164
165
12.8k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
12.8k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
12.8k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
12.8k
                if (to_scale > from_scale) {
170
3.13k
                    multiply_may_overflow &=
171
3.13k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
3.13k
                }
173
12.8k
                return narrow_integral || multiply_may_overflow;
174
12.8k
            }
175
0
            return false;
176
35.1k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
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
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
2
                using FromFieldType = typename FromDataType::FieldType;
133
2
                using ToFieldType = typename ToDataType::FieldType;
134
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
2
                UInt32 from_scale = 0;
136
137
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
2
                    const auto* from_decimal_type =
139
2
                            check_and_get_data_type<FromDataType>(from_type.get());
140
2
                    from_precision =
141
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
2
                    from_scale = from_decimal_type->get_scale();
143
2
                }
144
145
2
                UInt32 to_max_digits = 0;
146
2
                UInt32 to_precision = 0;
147
2
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
2
                    to_precision = to_max_digits;
163
2
                }
164
165
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
2
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
2
                return narrow_integral || multiply_may_overflow;
174
2
            }
175
0
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
2
                using FromFieldType = typename FromDataType::FieldType;
133
2
                using ToFieldType = typename ToDataType::FieldType;
134
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
2
                UInt32 from_scale = 0;
136
137
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
2
                    const auto* from_decimal_type =
139
2
                            check_and_get_data_type<FromDataType>(from_type.get());
140
2
                    from_precision =
141
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
2
                    from_scale = from_decimal_type->get_scale();
143
2
                }
144
145
2
                UInt32 to_max_digits = 0;
146
2
                UInt32 to_precision = 0;
147
2
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
2
                    to_precision = to_max_digits;
163
2
                }
164
165
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
2
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
2
                return narrow_integral || multiply_may_overflow;
174
2
            }
175
0
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
2
                using FromFieldType = typename FromDataType::FieldType;
133
2
                using ToFieldType = typename ToDataType::FieldType;
134
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
2
                UInt32 from_scale = 0;
136
137
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
2
                    const auto* from_decimal_type =
139
2
                            check_and_get_data_type<FromDataType>(from_type.get());
140
2
                    from_precision =
141
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
2
                    from_scale = from_decimal_type->get_scale();
143
2
                }
144
145
2
                UInt32 to_max_digits = 0;
146
2
                UInt32 to_precision = 0;
147
2
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
2
                    to_precision = to_max_digits;
163
2
                }
164
165
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
2
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
2
                return narrow_integral || multiply_may_overflow;
174
2
            }
175
0
            return false;
176
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
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
2
                using FromFieldType = typename FromDataType::FieldType;
133
2
                using ToFieldType = typename ToDataType::FieldType;
134
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
2
                UInt32 from_scale = 0;
136
137
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
2
                    const auto* from_decimal_type =
139
2
                            check_and_get_data_type<FromDataType>(from_type.get());
140
2
                    from_precision =
141
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
2
                    from_scale = from_decimal_type->get_scale();
143
2
                }
144
145
2
                UInt32 to_max_digits = 0;
146
2
                UInt32 to_precision = 0;
147
2
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
2
                    to_precision = to_max_digits;
163
2
                }
164
165
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
2
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
2
                return narrow_integral || multiply_may_overflow;
174
2
            }
175
0
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
2
                using FromFieldType = typename FromDataType::FieldType;
133
2
                using ToFieldType = typename ToDataType::FieldType;
134
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
2
                UInt32 from_scale = 0;
136
137
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
2
                    const auto* from_decimal_type =
139
2
                            check_and_get_data_type<FromDataType>(from_type.get());
140
2
                    from_precision =
141
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
2
                    from_scale = from_decimal_type->get_scale();
143
2
                }
144
145
2
                UInt32 to_max_digits = 0;
146
2
                UInt32 to_precision = 0;
147
2
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
2
                    to_precision = to_max_digits;
163
2
                }
164
165
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
2
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
2
                return narrow_integral || multiply_may_overflow;
174
2
            }
175
0
            return false;
176
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
123
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
12
            using Types2 = std::decay_t<decltype(types2)>;
125
12
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
12
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
12
                return false;
130
12
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
12
            return false;
176
12
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7
            return false;
176
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7
            return false;
176
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7
            return false;
176
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7
            return false;
176
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
123
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
23
            using Types2 = std::decay_t<decltype(types2)>;
125
23
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
23
            return false;
176
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
123
27
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
27
            using Types2 = std::decay_t<decltype(types2)>;
125
27
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
27
            return false;
176
27
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
123
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
14
            using Types2 = std::decay_t<decltype(types2)>;
125
14
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
14
                using FromFieldType = typename FromDataType::FieldType;
133
14
                using ToFieldType = typename ToDataType::FieldType;
134
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
14
                UInt32 from_scale = 0;
136
137
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
14
                    const auto* from_decimal_type =
139
14
                            check_and_get_data_type<FromDataType>(from_type.get());
140
14
                    from_precision =
141
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
14
                    from_scale = from_decimal_type->get_scale();
143
14
                }
144
145
14
                UInt32 to_max_digits = 0;
146
14
                UInt32 to_precision = 0;
147
14
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
14
                    to_precision = to_max_digits;
163
14
                }
164
165
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
14
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
14
                return narrow_integral || multiply_may_overflow;
174
14
            }
175
0
            return false;
176
14
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
123
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
8
            using Types2 = std::decay_t<decltype(types2)>;
125
8
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
8
                using FromFieldType = typename FromDataType::FieldType;
133
8
                using ToFieldType = typename ToDataType::FieldType;
134
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
8
                UInt32 from_scale = 0;
136
137
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
8
                    const auto* from_decimal_type =
139
8
                            check_and_get_data_type<FromDataType>(from_type.get());
140
8
                    from_precision =
141
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
8
                    from_scale = from_decimal_type->get_scale();
143
8
                }
144
145
8
                UInt32 to_max_digits = 0;
146
8
                UInt32 to_precision = 0;
147
8
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
8
                    to_precision = to_max_digits;
163
8
                }
164
165
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
8
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
8
                return narrow_integral || multiply_may_overflow;
174
8
            }
175
0
            return false;
176
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
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
123
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
72
            using Types2 = std::decay_t<decltype(types2)>;
125
72
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
72
            return false;
176
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
123
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
24
            using Types2 = std::decay_t<decltype(types2)>;
125
24
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
24
            return false;
176
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
123
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
320
            using Types2 = std::decay_t<decltype(types2)>;
125
320
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
320
            return false;
176
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
123
857
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
857
            using Types2 = std::decay_t<decltype(types2)>;
125
857
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
857
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
857
                return false;
130
857
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
857
            return false;
176
857
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7
            return false;
176
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7
            return false;
176
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7
            return false;
176
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
123
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
21
            using Types2 = std::decay_t<decltype(types2)>;
125
21
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
21
            return false;
176
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
123
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
25
            using Types2 = std::decay_t<decltype(types2)>;
125
25
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
25
            return false;
176
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
123
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
14
            using Types2 = std::decay_t<decltype(types2)>;
125
14
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
14
                using FromFieldType = typename FromDataType::FieldType;
133
14
                using ToFieldType = typename ToDataType::FieldType;
134
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
14
                UInt32 from_scale = 0;
136
137
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
14
                    const auto* from_decimal_type =
139
14
                            check_and_get_data_type<FromDataType>(from_type.get());
140
14
                    from_precision =
141
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
14
                    from_scale = from_decimal_type->get_scale();
143
14
                }
144
145
14
                UInt32 to_max_digits = 0;
146
14
                UInt32 to_precision = 0;
147
14
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
14
                    to_precision = to_max_digits;
163
14
                }
164
165
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
14
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
14
                return narrow_integral || multiply_may_overflow;
174
14
            }
175
0
            return false;
176
14
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
123
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
8
            using Types2 = std::decay_t<decltype(types2)>;
125
8
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
8
                using FromFieldType = typename FromDataType::FieldType;
133
8
                using ToFieldType = typename ToDataType::FieldType;
134
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
8
                UInt32 from_scale = 0;
136
137
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
8
                    const auto* from_decimal_type =
139
8
                            check_and_get_data_type<FromDataType>(from_type.get());
140
8
                    from_precision =
141
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
8
                    from_scale = from_decimal_type->get_scale();
143
8
                }
144
145
8
                UInt32 to_max_digits = 0;
146
8
                UInt32 to_precision = 0;
147
8
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
8
                    to_precision = to_max_digits;
163
8
                }
164
165
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
8
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
8
                return narrow_integral || multiply_may_overflow;
174
8
            }
175
0
            return false;
176
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
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
123
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
72
            using Types2 = std::decay_t<decltype(types2)>;
125
72
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
72
            return false;
176
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
123
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
24
            using Types2 = std::decay_t<decltype(types2)>;
125
24
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
24
            return false;
176
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
123
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
320
            using Types2 = std::decay_t<decltype(types2)>;
125
320
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
320
            return false;
176
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
123
841
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
841
            using Types2 = std::decay_t<decltype(types2)>;
125
841
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
841
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
841
                return false;
130
841
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
841
            return false;
176
841
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
123
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
4
            using Types2 = std::decay_t<decltype(types2)>;
125
4
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
4
            return false;
176
4
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
123
38
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
38
            using Types2 = std::decay_t<decltype(types2)>;
125
38
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
38
            return false;
176
38
        });
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
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7
            return false;
176
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
123
17
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
17
            using Types2 = std::decay_t<decltype(types2)>;
125
17
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
17
            return false;
176
17
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
123
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
21
            using Types2 = std::decay_t<decltype(types2)>;
125
21
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
21
            return false;
176
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
123
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
14
            using Types2 = std::decay_t<decltype(types2)>;
125
14
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
14
                using FromFieldType = typename FromDataType::FieldType;
133
14
                using ToFieldType = typename ToDataType::FieldType;
134
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
14
                UInt32 from_scale = 0;
136
137
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
14
                    const auto* from_decimal_type =
139
14
                            check_and_get_data_type<FromDataType>(from_type.get());
140
14
                    from_precision =
141
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
14
                    from_scale = from_decimal_type->get_scale();
143
14
                }
144
145
14
                UInt32 to_max_digits = 0;
146
14
                UInt32 to_precision = 0;
147
14
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
14
                    to_precision = to_max_digits;
163
14
                }
164
165
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
14
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
14
                return narrow_integral || multiply_may_overflow;
174
14
            }
175
0
            return false;
176
14
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
123
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
8
            using Types2 = std::decay_t<decltype(types2)>;
125
8
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
8
                using FromFieldType = typename FromDataType::FieldType;
133
8
                using ToFieldType = typename ToDataType::FieldType;
134
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
8
                UInt32 from_scale = 0;
136
137
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
8
                    const auto* from_decimal_type =
139
8
                            check_and_get_data_type<FromDataType>(from_type.get());
140
8
                    from_precision =
141
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
8
                    from_scale = from_decimal_type->get_scale();
143
8
                }
144
145
8
                UInt32 to_max_digits = 0;
146
8
                UInt32 to_precision = 0;
147
8
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
8
                    to_precision = to_max_digits;
163
8
                }
164
165
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
8
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
8
                return narrow_integral || multiply_may_overflow;
174
8
            }
175
0
            return false;
176
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
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
123
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
24
            using Types2 = std::decay_t<decltype(types2)>;
125
24
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
24
            return false;
176
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
123
276
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
276
            using Types2 = std::decay_t<decltype(types2)>;
125
276
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
276
            return false;
176
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
123
828
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
828
            using Types2 = std::decay_t<decltype(types2)>;
125
828
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
828
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
828
                return false;
130
828
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
828
            return false;
176
828
        });
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
123
94
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
94
            using Types2 = std::decay_t<decltype(types2)>;
125
94
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
94
            return false;
176
94
        });
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
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
123
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
10
            using Types2 = std::decay_t<decltype(types2)>;
125
10
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
10
            return false;
176
10
        });
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
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7
            return false;
176
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
123
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
13
            using Types2 = std::decay_t<decltype(types2)>;
125
13
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
13
            return false;
176
13
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
123
17
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
17
            using Types2 = std::decay_t<decltype(types2)>;
125
17
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
17
            return false;
176
17
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
123
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
14
            using Types2 = std::decay_t<decltype(types2)>;
125
14
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
14
                using FromFieldType = typename FromDataType::FieldType;
133
14
                using ToFieldType = typename ToDataType::FieldType;
134
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
14
                UInt32 from_scale = 0;
136
137
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
14
                    const auto* from_decimal_type =
139
14
                            check_and_get_data_type<FromDataType>(from_type.get());
140
14
                    from_precision =
141
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
14
                    from_scale = from_decimal_type->get_scale();
143
14
                }
144
145
14
                UInt32 to_max_digits = 0;
146
14
                UInt32 to_precision = 0;
147
14
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
14
                    to_precision = to_max_digits;
163
14
                }
164
165
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
14
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
14
                return narrow_integral || multiply_may_overflow;
174
14
            }
175
0
            return false;
176
14
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
123
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
8
            using Types2 = std::decay_t<decltype(types2)>;
125
8
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
8
                using FromFieldType = typename FromDataType::FieldType;
133
8
                using ToFieldType = typename ToDataType::FieldType;
134
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
8
                UInt32 from_scale = 0;
136
137
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
8
                    const auto* from_decimal_type =
139
8
                            check_and_get_data_type<FromDataType>(from_type.get());
140
8
                    from_precision =
141
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
8
                    from_scale = from_decimal_type->get_scale();
143
8
                }
144
145
8
                UInt32 to_max_digits = 0;
146
8
                UInt32 to_precision = 0;
147
8
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
8
                    to_precision = to_max_digits;
163
8
                }
164
165
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
8
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
8
                return narrow_integral || multiply_may_overflow;
174
8
            }
175
0
            return false;
176
8
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
123
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
8
            using Types2 = std::decay_t<decltype(types2)>;
125
8
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
8
            return false;
176
8
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
123
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
4
            using Types2 = std::decay_t<decltype(types2)>;
125
4
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
4
            return false;
176
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
123
809
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
809
            using Types2 = std::decay_t<decltype(types2)>;
125
809
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
809
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
809
                return false;
130
809
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
809
            return false;
176
809
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
123
98
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
98
            using Types2 = std::decay_t<decltype(types2)>;
125
98
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
98
            return false;
176
98
        });
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
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
123
77
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
77
            using Types2 = std::decay_t<decltype(types2)>;
125
77
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
77
            return false;
176
77
        });
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
123
9
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
9
            using Types2 = std::decay_t<decltype(types2)>;
125
9
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
9
            return false;
176
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
123
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
13
            using Types2 = std::decay_t<decltype(types2)>;
125
13
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
13
            return false;
176
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
123
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
14
            using Types2 = std::decay_t<decltype(types2)>;
125
14
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
14
                using FromFieldType = typename FromDataType::FieldType;
133
14
                using ToFieldType = typename ToDataType::FieldType;
134
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
14
                UInt32 from_scale = 0;
136
137
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
14
                    const auto* from_decimal_type =
139
14
                            check_and_get_data_type<FromDataType>(from_type.get());
140
14
                    from_precision =
141
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
14
                    from_scale = from_decimal_type->get_scale();
143
14
                }
144
145
14
                UInt32 to_max_digits = 0;
146
14
                UInt32 to_precision = 0;
147
14
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
14
                    to_precision = to_max_digits;
163
14
                }
164
165
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
14
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
14
                return narrow_integral || multiply_may_overflow;
174
14
            }
175
0
            return false;
176
14
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
123
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
8
            using Types2 = std::decay_t<decltype(types2)>;
125
8
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
8
                using FromFieldType = typename FromDataType::FieldType;
133
8
                using ToFieldType = typename ToDataType::FieldType;
134
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
8
                UInt32 from_scale = 0;
136
137
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
8
                    const auto* from_decimal_type =
139
8
                            check_and_get_data_type<FromDataType>(from_type.get());
140
8
                    from_precision =
141
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
8
                    from_scale = from_decimal_type->get_scale();
143
8
                }
144
145
8
                UInt32 to_max_digits = 0;
146
8
                UInt32 to_precision = 0;
147
8
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
8
                    to_precision = to_max_digits;
163
8
                }
164
165
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
8
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
8
                return narrow_integral || multiply_may_overflow;
174
8
            }
175
0
            return false;
176
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
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
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
123
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
8
            using Types2 = std::decay_t<decltype(types2)>;
125
8
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
8
            return false;
176
8
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
123
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
4
            using Types2 = std::decay_t<decltype(types2)>;
125
4
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
4
            return false;
176
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
123
793
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
793
            using Types2 = std::decay_t<decltype(types2)>;
125
793
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
793
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
793
                return false;
130
793
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
793
            return false;
176
793
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
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
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
123
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
14
            using Types2 = std::decay_t<decltype(types2)>;
125
14
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
14
                using FromFieldType = typename FromDataType::FieldType;
133
14
                using ToFieldType = typename ToDataType::FieldType;
134
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
14
                UInt32 from_scale = 0;
136
137
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
14
                    const auto* from_decimal_type =
139
14
                            check_and_get_data_type<FromDataType>(from_type.get());
140
14
                    from_precision =
141
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
14
                    from_scale = from_decimal_type->get_scale();
143
14
                }
144
145
14
                UInt32 to_max_digits = 0;
146
14
                UInt32 to_precision = 0;
147
14
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
14
                    to_precision = to_max_digits;
163
14
                }
164
165
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
14
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
14
                return narrow_integral || multiply_may_overflow;
174
14
            }
175
0
            return false;
176
14
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
123
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
16
            using Types2 = std::decay_t<decltype(types2)>;
125
16
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
16
                using FromFieldType = typename FromDataType::FieldType;
133
16
                using ToFieldType = typename ToDataType::FieldType;
134
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
16
                UInt32 from_scale = 0;
136
137
16
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
16
                    const auto* from_decimal_type =
139
16
                            check_and_get_data_type<FromDataType>(from_type.get());
140
16
                    from_precision =
141
16
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
16
                    from_scale = from_decimal_type->get_scale();
143
16
                }
144
145
16
                UInt32 to_max_digits = 0;
146
16
                UInt32 to_precision = 0;
147
16
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
16
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
16
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
16
                    to_precision = to_max_digits;
163
16
                }
164
165
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
16
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
16
                return narrow_integral || multiply_may_overflow;
174
16
            }
175
0
            return false;
176
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
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
123
36
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
36
            using Types2 = std::decay_t<decltype(types2)>;
125
36
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
36
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
36
                using FromFieldType = typename FromDataType::FieldType;
133
36
                using ToFieldType = typename ToDataType::FieldType;
134
36
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
36
                UInt32 from_scale = 0;
136
137
36
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
36
                    const auto* from_decimal_type =
139
36
                            check_and_get_data_type<FromDataType>(from_type.get());
140
36
                    from_precision =
141
36
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
36
                    from_scale = from_decimal_type->get_scale();
143
36
                }
144
145
36
                UInt32 to_max_digits = 0;
146
36
                UInt32 to_precision = 0;
147
36
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
36
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
36
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
36
                    to_precision = to_max_digits;
163
36
                }
164
165
36
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
36
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
36
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
36
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
36
                return narrow_integral || multiply_may_overflow;
174
36
            }
175
0
            return false;
176
36
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
123
37
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
37
            using Types2 = std::decay_t<decltype(types2)>;
125
37
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
37
            return false;
176
37
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
123
7.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7.78k
            using Types2 = std::decay_t<decltype(types2)>;
125
7.78k
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7.78k
            return false;
176
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
123
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
162
            using Types2 = std::decay_t<decltype(types2)>;
125
162
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
162
            return false;
176
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
123
80
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
80
            using Types2 = std::decay_t<decltype(types2)>;
125
80
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
80
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
80
                return false;
130
80
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
80
            return false;
176
80
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
123
78
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
78
            using Types2 = std::decay_t<decltype(types2)>;
125
78
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
78
            return false;
176
78
        });
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
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
123
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
14
            using Types2 = std::decay_t<decltype(types2)>;
125
14
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
14
                using FromFieldType = typename FromDataType::FieldType;
133
14
                using ToFieldType = typename ToDataType::FieldType;
134
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
14
                UInt32 from_scale = 0;
136
137
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
14
                    const auto* from_decimal_type =
139
14
                            check_and_get_data_type<FromDataType>(from_type.get());
140
14
                    from_precision =
141
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
14
                    from_scale = from_decimal_type->get_scale();
143
14
                }
144
145
14
                UInt32 to_max_digits = 0;
146
14
                UInt32 to_precision = 0;
147
14
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
14
                    to_precision = to_max_digits;
163
14
                }
164
165
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
14
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
14
                return narrow_integral || multiply_may_overflow;
174
14
            }
175
0
            return false;
176
14
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
123
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
16
            using Types2 = std::decay_t<decltype(types2)>;
125
16
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
16
                using FromFieldType = typename FromDataType::FieldType;
133
16
                using ToFieldType = typename ToDataType::FieldType;
134
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
16
                UInt32 from_scale = 0;
136
137
16
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
16
                    const auto* from_decimal_type =
139
16
                            check_and_get_data_type<FromDataType>(from_type.get());
140
16
                    from_precision =
141
16
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
16
                    from_scale = from_decimal_type->get_scale();
143
16
                }
144
145
16
                UInt32 to_max_digits = 0;
146
16
                UInt32 to_precision = 0;
147
16
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
16
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
16
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
16
                    to_precision = to_max_digits;
163
16
                }
164
165
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
16
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
16
                return narrow_integral || multiply_may_overflow;
174
16
            }
175
0
            return false;
176
16
        });
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
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
123
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
18
            using Types2 = std::decay_t<decltype(types2)>;
125
18
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
18
                using FromFieldType = typename FromDataType::FieldType;
133
18
                using ToFieldType = typename ToDataType::FieldType;
134
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
18
                UInt32 from_scale = 0;
136
137
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
18
                    const auto* from_decimal_type =
139
18
                            check_and_get_data_type<FromDataType>(from_type.get());
140
18
                    from_precision =
141
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
18
                    from_scale = from_decimal_type->get_scale();
143
18
                }
144
145
18
                UInt32 to_max_digits = 0;
146
18
                UInt32 to_precision = 0;
147
18
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
18
                    to_precision = to_max_digits;
163
18
                }
164
165
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
18
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
18
                return narrow_integral || multiply_may_overflow;
174
18
            }
175
0
            return false;
176
18
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
123
37
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
37
            using Types2 = std::decay_t<decltype(types2)>;
125
37
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
37
            return false;
176
37
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
123
7.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7.78k
            using Types2 = std::decay_t<decltype(types2)>;
125
7.78k
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7.78k
            return false;
176
7.78k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
123
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
162
            using Types2 = std::decay_t<decltype(types2)>;
125
162
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
162
            return false;
176
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
123
80
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
80
            using Types2 = std::decay_t<decltype(types2)>;
125
80
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
80
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
80
                return false;
130
80
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
80
            return false;
176
80
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
7
                using FromFieldType = typename FromDataType::FieldType;
133
7
                using ToFieldType = typename ToDataType::FieldType;
134
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
7
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
7
                UInt32 to_max_digits = 0;
146
7
                UInt32 to_precision = 0;
147
7
                UInt32 to_scale = 0;
148
149
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
7
                    const auto* to_decimal_type =
153
7
                            check_and_get_data_type<ToDataType>(to_type.get());
154
7
                    to_precision = to_decimal_type->get_precision();
155
7
                    ToDataType::check_type_precision(to_precision);
156
157
7
                    to_scale = to_decimal_type->get_scale();
158
7
                    ToDataType::check_type_scale(to_scale);
159
7
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
7
                if (to_scale > from_scale) {
170
6
                    multiply_may_overflow &=
171
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
6
                }
173
7
                return narrow_integral || multiply_may_overflow;
174
7
            }
175
0
            return false;
176
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
123
34
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
34
            using Types2 = std::decay_t<decltype(types2)>;
125
34
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
34
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
34
                using FromFieldType = typename FromDataType::FieldType;
133
34
                using ToFieldType = typename ToDataType::FieldType;
134
34
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
34
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
34
                UInt32 to_max_digits = 0;
146
34
                UInt32 to_precision = 0;
147
34
                UInt32 to_scale = 0;
148
149
34
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
34
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
34
                    const auto* to_decimal_type =
153
34
                            check_and_get_data_type<ToDataType>(to_type.get());
154
34
                    to_precision = to_decimal_type->get_precision();
155
34
                    ToDataType::check_type_precision(to_precision);
156
157
34
                    to_scale = to_decimal_type->get_scale();
158
34
                    ToDataType::check_type_scale(to_scale);
159
34
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
34
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
34
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
34
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
34
                if (to_scale > from_scale) {
170
23
                    multiply_may_overflow &=
171
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
23
                }
173
34
                return narrow_integral || multiply_may_overflow;
174
34
            }
175
0
            return false;
176
34
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
123
39
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
39
            using Types2 = std::decay_t<decltype(types2)>;
125
39
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
39
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
39
                using FromFieldType = typename FromDataType::FieldType;
133
39
                using ToFieldType = typename ToDataType::FieldType;
134
39
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
39
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
39
                UInt32 to_max_digits = 0;
146
39
                UInt32 to_precision = 0;
147
39
                UInt32 to_scale = 0;
148
149
39
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
39
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
39
                    const auto* to_decimal_type =
153
39
                            check_and_get_data_type<ToDataType>(to_type.get());
154
39
                    to_precision = to_decimal_type->get_precision();
155
39
                    ToDataType::check_type_precision(to_precision);
156
157
39
                    to_scale = to_decimal_type->get_scale();
158
39
                    ToDataType::check_type_scale(to_scale);
159
39
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
39
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
39
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
39
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
39
                if (to_scale > from_scale) {
170
23
                    multiply_may_overflow &=
171
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
23
                }
173
39
                return narrow_integral || multiply_may_overflow;
174
39
            }
175
0
            return false;
176
39
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
123
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
49
            using Types2 = std::decay_t<decltype(types2)>;
125
49
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
49
                using FromFieldType = typename FromDataType::FieldType;
133
49
                using ToFieldType = typename ToDataType::FieldType;
134
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
49
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
49
                UInt32 to_max_digits = 0;
146
49
                UInt32 to_precision = 0;
147
49
                UInt32 to_scale = 0;
148
149
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
49
                    const auto* to_decimal_type =
153
49
                            check_and_get_data_type<ToDataType>(to_type.get());
154
49
                    to_precision = to_decimal_type->get_precision();
155
49
                    ToDataType::check_type_precision(to_precision);
156
157
49
                    to_scale = to_decimal_type->get_scale();
158
49
                    ToDataType::check_type_scale(to_scale);
159
49
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
49
                if (to_scale > from_scale) {
170
28
                    multiply_may_overflow &=
171
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
28
                }
173
49
                return narrow_integral || multiply_may_overflow;
174
49
            }
175
0
            return false;
176
49
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
123
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
49
            using Types2 = std::decay_t<decltype(types2)>;
125
49
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
49
                using FromFieldType = typename FromDataType::FieldType;
133
49
                using ToFieldType = typename ToDataType::FieldType;
134
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
49
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
49
                UInt32 to_max_digits = 0;
146
49
                UInt32 to_precision = 0;
147
49
                UInt32 to_scale = 0;
148
149
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
49
                    const auto* to_decimal_type =
153
49
                            check_and_get_data_type<ToDataType>(to_type.get());
154
49
                    to_precision = to_decimal_type->get_precision();
155
49
                    ToDataType::check_type_precision(to_precision);
156
157
49
                    to_scale = to_decimal_type->get_scale();
158
49
                    ToDataType::check_type_scale(to_scale);
159
49
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
49
                if (to_scale > from_scale) {
170
28
                    multiply_may_overflow &=
171
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
28
                }
173
49
                return narrow_integral || multiply_may_overflow;
174
49
            }
175
0
            return false;
176
49
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
123
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
49
            using Types2 = std::decay_t<decltype(types2)>;
125
49
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
49
                using FromFieldType = typename FromDataType::FieldType;
133
49
                using ToFieldType = typename ToDataType::FieldType;
134
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
49
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
49
                UInt32 to_max_digits = 0;
146
49
                UInt32 to_precision = 0;
147
49
                UInt32 to_scale = 0;
148
149
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
49
                    const auto* to_decimal_type =
153
49
                            check_and_get_data_type<ToDataType>(to_type.get());
154
49
                    to_precision = to_decimal_type->get_precision();
155
49
                    ToDataType::check_type_precision(to_precision);
156
157
49
                    to_scale = to_decimal_type->get_scale();
158
49
                    ToDataType::check_type_scale(to_scale);
159
49
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
49
                if (to_scale > from_scale) {
170
28
                    multiply_may_overflow &=
171
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
28
                }
173
49
                return narrow_integral || multiply_may_overflow;
174
49
            }
175
0
            return false;
176
49
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
123
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
99
            using Types2 = std::decay_t<decltype(types2)>;
125
99
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
99
                using FromFieldType = typename FromDataType::FieldType;
133
99
                using ToFieldType = typename ToDataType::FieldType;
134
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
99
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
99
                UInt32 to_max_digits = 0;
146
99
                UInt32 to_precision = 0;
147
99
                UInt32 to_scale = 0;
148
149
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
99
                    const auto* to_decimal_type =
153
99
                            check_and_get_data_type<ToDataType>(to_type.get());
154
99
                    to_precision = to_decimal_type->get_precision();
155
99
                    ToDataType::check_type_precision(to_precision);
156
157
99
                    to_scale = to_decimal_type->get_scale();
158
99
                    ToDataType::check_type_scale(to_scale);
159
99
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
99
                if (to_scale > from_scale) {
170
66
                    multiply_may_overflow &=
171
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
66
                }
173
99
                return narrow_integral || multiply_may_overflow;
174
99
            }
175
0
            return false;
176
99
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
123
103
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
103
            using Types2 = std::decay_t<decltype(types2)>;
125
103
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
103
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
103
                using FromFieldType = typename FromDataType::FieldType;
133
103
                using ToFieldType = typename ToDataType::FieldType;
134
103
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
103
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
103
                UInt32 to_max_digits = 0;
146
103
                UInt32 to_precision = 0;
147
103
                UInt32 to_scale = 0;
148
149
103
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
103
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
103
                    const auto* to_decimal_type =
153
103
                            check_and_get_data_type<ToDataType>(to_type.get());
154
103
                    to_precision = to_decimal_type->get_precision();
155
103
                    ToDataType::check_type_precision(to_precision);
156
157
103
                    to_scale = to_decimal_type->get_scale();
158
103
                    ToDataType::check_type_scale(to_scale);
159
103
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
103
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
103
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
103
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
103
                if (to_scale > from_scale) {
170
66
                    multiply_may_overflow &=
171
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
66
                }
173
103
                return narrow_integral || multiply_may_overflow;
174
103
            }
175
0
            return false;
176
103
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
123
128
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
128
            using Types2 = std::decay_t<decltype(types2)>;
125
128
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
128
                using FromFieldType = typename FromDataType::FieldType;
133
128
                using ToFieldType = typename ToDataType::FieldType;
134
128
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
128
                UInt32 from_scale = 0;
136
137
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
128
                    const auto* from_decimal_type =
139
128
                            check_and_get_data_type<FromDataType>(from_type.get());
140
128
                    from_precision =
141
128
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
128
                    from_scale = from_decimal_type->get_scale();
143
128
                }
144
145
128
                UInt32 to_max_digits = 0;
146
128
                UInt32 to_precision = 0;
147
128
                UInt32 to_scale = 0;
148
149
128
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
128
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
128
                    const auto* to_decimal_type =
153
128
                            check_and_get_data_type<ToDataType>(to_type.get());
154
128
                    to_precision = to_decimal_type->get_precision();
155
128
                    ToDataType::check_type_precision(to_precision);
156
157
128
                    to_scale = to_decimal_type->get_scale();
158
128
                    ToDataType::check_type_scale(to_scale);
159
128
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
128
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
128
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
128
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
128
                if (to_scale > from_scale) {
170
62
                    multiply_may_overflow &=
171
62
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
62
                }
173
128
                return narrow_integral || multiply_may_overflow;
174
128
            }
175
0
            return false;
176
128
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
123
285
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
285
            using Types2 = std::decay_t<decltype(types2)>;
125
285
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
285
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
285
                using FromFieldType = typename FromDataType::FieldType;
133
285
                using ToFieldType = typename ToDataType::FieldType;
134
285
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
285
                UInt32 from_scale = 0;
136
137
285
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
285
                    const auto* from_decimal_type =
139
285
                            check_and_get_data_type<FromDataType>(from_type.get());
140
285
                    from_precision =
141
285
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
285
                    from_scale = from_decimal_type->get_scale();
143
285
                }
144
145
285
                UInt32 to_max_digits = 0;
146
285
                UInt32 to_precision = 0;
147
285
                UInt32 to_scale = 0;
148
149
285
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
285
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
285
                    const auto* to_decimal_type =
153
285
                            check_and_get_data_type<ToDataType>(to_type.get());
154
285
                    to_precision = to_decimal_type->get_precision();
155
285
                    ToDataType::check_type_precision(to_precision);
156
157
285
                    to_scale = to_decimal_type->get_scale();
158
285
                    ToDataType::check_type_scale(to_scale);
159
285
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
285
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
285
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
285
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
285
                if (to_scale > from_scale) {
170
78
                    multiply_may_overflow &=
171
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
78
                }
173
285
                return narrow_integral || multiply_may_overflow;
174
285
            }
175
0
            return false;
176
285
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
123
161
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
161
            using Types2 = std::decay_t<decltype(types2)>;
125
161
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
161
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
161
                using FromFieldType = typename FromDataType::FieldType;
133
161
                using ToFieldType = typename ToDataType::FieldType;
134
161
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
161
                UInt32 from_scale = 0;
136
137
161
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
161
                    const auto* from_decimal_type =
139
161
                            check_and_get_data_type<FromDataType>(from_type.get());
140
161
                    from_precision =
141
161
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
161
                    from_scale = from_decimal_type->get_scale();
143
161
                }
144
145
161
                UInt32 to_max_digits = 0;
146
161
                UInt32 to_precision = 0;
147
161
                UInt32 to_scale = 0;
148
149
161
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
161
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
161
                    const auto* to_decimal_type =
153
161
                            check_and_get_data_type<ToDataType>(to_type.get());
154
161
                    to_precision = to_decimal_type->get_precision();
155
161
                    ToDataType::check_type_precision(to_precision);
156
157
161
                    to_scale = to_decimal_type->get_scale();
158
161
                    ToDataType::check_type_scale(to_scale);
159
161
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
161
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
161
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
161
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
161
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
161
                return narrow_integral || multiply_may_overflow;
174
161
            }
175
0
            return false;
176
161
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
123
296
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
296
            using Types2 = std::decay_t<decltype(types2)>;
125
296
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
296
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
296
                using FromFieldType = typename FromDataType::FieldType;
133
296
                using ToFieldType = typename ToDataType::FieldType;
134
296
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
296
                UInt32 from_scale = 0;
136
137
296
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
296
                    const auto* from_decimal_type =
139
296
                            check_and_get_data_type<FromDataType>(from_type.get());
140
296
                    from_precision =
141
296
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
296
                    from_scale = from_decimal_type->get_scale();
143
296
                }
144
145
296
                UInt32 to_max_digits = 0;
146
296
                UInt32 to_precision = 0;
147
296
                UInt32 to_scale = 0;
148
149
296
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
296
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
296
                    const auto* to_decimal_type =
153
296
                            check_and_get_data_type<ToDataType>(to_type.get());
154
296
                    to_precision = to_decimal_type->get_precision();
155
296
                    ToDataType::check_type_precision(to_precision);
156
157
296
                    to_scale = to_decimal_type->get_scale();
158
296
                    ToDataType::check_type_scale(to_scale);
159
296
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
296
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
296
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
296
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
296
                if (to_scale > from_scale) {
170
78
                    multiply_may_overflow &=
171
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
78
                }
173
296
                return narrow_integral || multiply_may_overflow;
174
296
            }
175
0
            return false;
176
296
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Line
Count
Source
123
296
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
296
            using Types2 = std::decay_t<decltype(types2)>;
125
296
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
296
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
296
                using FromFieldType = typename FromDataType::FieldType;
133
296
                using ToFieldType = typename ToDataType::FieldType;
134
296
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
296
                UInt32 from_scale = 0;
136
137
296
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
296
                    const auto* from_decimal_type =
139
296
                            check_and_get_data_type<FromDataType>(from_type.get());
140
296
                    from_precision =
141
296
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
296
                    from_scale = from_decimal_type->get_scale();
143
296
                }
144
145
296
                UInt32 to_max_digits = 0;
146
296
                UInt32 to_precision = 0;
147
296
                UInt32 to_scale = 0;
148
149
296
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
296
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
296
                    const auto* to_decimal_type =
153
296
                            check_and_get_data_type<ToDataType>(to_type.get());
154
296
                    to_precision = to_decimal_type->get_precision();
155
296
                    ToDataType::check_type_precision(to_precision);
156
157
296
                    to_scale = to_decimal_type->get_scale();
158
296
                    ToDataType::check_type_scale(to_scale);
159
296
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
296
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
296
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
296
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
296
                if (to_scale > from_scale) {
170
78
                    multiply_may_overflow &=
171
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
78
                }
173
296
                return narrow_integral || multiply_may_overflow;
174
296
            }
175
0
            return false;
176
296
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
123
1.63k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1.63k
            using Types2 = std::decay_t<decltype(types2)>;
125
1.63k
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
1.63k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
1.63k
                return false;
130
1.63k
            }
131
1.63k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
1.63k
                using FromFieldType = typename FromDataType::FieldType;
133
1.63k
                using ToFieldType = typename ToDataType::FieldType;
134
1.63k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
1.63k
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
1.63k
                UInt32 to_max_digits = 0;
146
1.63k
                UInt32 to_precision = 0;
147
1.63k
                UInt32 to_scale = 0;
148
149
1.63k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
1.63k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
1.63k
                    const auto* to_decimal_type =
153
1.63k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
1.63k
                    to_precision = to_decimal_type->get_precision();
155
1.63k
                    ToDataType::check_type_precision(to_precision);
156
157
1.63k
                    to_scale = to_decimal_type->get_scale();
158
1.63k
                    ToDataType::check_type_scale(to_scale);
159
1.63k
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
1.63k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
1.63k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
1.63k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
1.63k
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
1.63k
                return narrow_integral || multiply_may_overflow;
174
1.63k
            }
175
0
            return false;
176
1.63k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
7
                using FromFieldType = typename FromDataType::FieldType;
133
7
                using ToFieldType = typename ToDataType::FieldType;
134
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
7
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
7
                UInt32 to_max_digits = 0;
146
7
                UInt32 to_precision = 0;
147
7
                UInt32 to_scale = 0;
148
149
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
7
                    const auto* to_decimal_type =
153
7
                            check_and_get_data_type<ToDataType>(to_type.get());
154
7
                    to_precision = to_decimal_type->get_precision();
155
7
                    ToDataType::check_type_precision(to_precision);
156
157
7
                    to_scale = to_decimal_type->get_scale();
158
7
                    ToDataType::check_type_scale(to_scale);
159
7
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
7
                if (to_scale > from_scale) {
170
6
                    multiply_may_overflow &=
171
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
6
                }
173
7
                return narrow_integral || multiply_may_overflow;
174
7
            }
175
0
            return false;
176
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
123
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
29
            using Types2 = std::decay_t<decltype(types2)>;
125
29
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
29
                using FromFieldType = typename FromDataType::FieldType;
133
29
                using ToFieldType = typename ToDataType::FieldType;
134
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
29
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
29
                UInt32 to_max_digits = 0;
146
29
                UInt32 to_precision = 0;
147
29
                UInt32 to_scale = 0;
148
149
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
29
                    const auto* to_decimal_type =
153
29
                            check_and_get_data_type<ToDataType>(to_type.get());
154
29
                    to_precision = to_decimal_type->get_precision();
155
29
                    ToDataType::check_type_precision(to_precision);
156
157
29
                    to_scale = to_decimal_type->get_scale();
158
29
                    ToDataType::check_type_scale(to_scale);
159
29
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
29
                if (to_scale > from_scale) {
170
18
                    multiply_may_overflow &=
171
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
18
                }
173
29
                return narrow_integral || multiply_may_overflow;
174
29
            }
175
0
            return false;
176
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
123
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
29
            using Types2 = std::decay_t<decltype(types2)>;
125
29
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
29
                using FromFieldType = typename FromDataType::FieldType;
133
29
                using ToFieldType = typename ToDataType::FieldType;
134
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
29
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
29
                UInt32 to_max_digits = 0;
146
29
                UInt32 to_precision = 0;
147
29
                UInt32 to_scale = 0;
148
149
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
29
                    const auto* to_decimal_type =
153
29
                            check_and_get_data_type<ToDataType>(to_type.get());
154
29
                    to_precision = to_decimal_type->get_precision();
155
29
                    ToDataType::check_type_precision(to_precision);
156
157
29
                    to_scale = to_decimal_type->get_scale();
158
29
                    ToDataType::check_type_scale(to_scale);
159
29
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
29
                if (to_scale > from_scale) {
170
18
                    multiply_may_overflow &=
171
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
18
                }
173
29
                return narrow_integral || multiply_may_overflow;
174
29
            }
175
0
            return false;
176
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
123
44
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
44
            using Types2 = std::decay_t<decltype(types2)>;
125
44
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
44
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
44
                using FromFieldType = typename FromDataType::FieldType;
133
44
                using ToFieldType = typename ToDataType::FieldType;
134
44
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
44
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
44
                UInt32 to_max_digits = 0;
146
44
                UInt32 to_precision = 0;
147
44
                UInt32 to_scale = 0;
148
149
44
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
44
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
44
                    const auto* to_decimal_type =
153
44
                            check_and_get_data_type<ToDataType>(to_type.get());
154
44
                    to_precision = to_decimal_type->get_precision();
155
44
                    ToDataType::check_type_precision(to_precision);
156
157
44
                    to_scale = to_decimal_type->get_scale();
158
44
                    ToDataType::check_type_scale(to_scale);
159
44
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
44
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
44
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
44
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
44
                if (to_scale > from_scale) {
170
28
                    multiply_may_overflow &=
171
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
28
                }
173
44
                return narrow_integral || multiply_may_overflow;
174
44
            }
175
0
            return false;
176
44
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
123
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
49
            using Types2 = std::decay_t<decltype(types2)>;
125
49
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
49
                using FromFieldType = typename FromDataType::FieldType;
133
49
                using ToFieldType = typename ToDataType::FieldType;
134
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
49
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
49
                UInt32 to_max_digits = 0;
146
49
                UInt32 to_precision = 0;
147
49
                UInt32 to_scale = 0;
148
149
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
49
                    const auto* to_decimal_type =
153
49
                            check_and_get_data_type<ToDataType>(to_type.get());
154
49
                    to_precision = to_decimal_type->get_precision();
155
49
                    ToDataType::check_type_precision(to_precision);
156
157
49
                    to_scale = to_decimal_type->get_scale();
158
49
                    ToDataType::check_type_scale(to_scale);
159
49
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
49
                if (to_scale > from_scale) {
170
28
                    multiply_may_overflow &=
171
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
28
                }
173
49
                return narrow_integral || multiply_may_overflow;
174
49
            }
175
0
            return false;
176
49
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
123
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
49
            using Types2 = std::decay_t<decltype(types2)>;
125
49
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
49
                using FromFieldType = typename FromDataType::FieldType;
133
49
                using ToFieldType = typename ToDataType::FieldType;
134
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
49
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
49
                UInt32 to_max_digits = 0;
146
49
                UInt32 to_precision = 0;
147
49
                UInt32 to_scale = 0;
148
149
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
49
                    const auto* to_decimal_type =
153
49
                            check_and_get_data_type<ToDataType>(to_type.get());
154
49
                    to_precision = to_decimal_type->get_precision();
155
49
                    ToDataType::check_type_precision(to_precision);
156
157
49
                    to_scale = to_decimal_type->get_scale();
158
49
                    ToDataType::check_type_scale(to_scale);
159
49
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
49
                if (to_scale > from_scale) {
170
28
                    multiply_may_overflow &=
171
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
28
                }
173
49
                return narrow_integral || multiply_may_overflow;
174
49
            }
175
0
            return false;
176
49
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
123
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
99
            using Types2 = std::decay_t<decltype(types2)>;
125
99
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
99
                using FromFieldType = typename FromDataType::FieldType;
133
99
                using ToFieldType = typename ToDataType::FieldType;
134
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
99
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
99
                UInt32 to_max_digits = 0;
146
99
                UInt32 to_precision = 0;
147
99
                UInt32 to_scale = 0;
148
149
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
99
                    const auto* to_decimal_type =
153
99
                            check_and_get_data_type<ToDataType>(to_type.get());
154
99
                    to_precision = to_decimal_type->get_precision();
155
99
                    ToDataType::check_type_precision(to_precision);
156
157
99
                    to_scale = to_decimal_type->get_scale();
158
99
                    ToDataType::check_type_scale(to_scale);
159
99
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
99
                if (to_scale > from_scale) {
170
58
                    multiply_may_overflow &=
171
58
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
58
                }
173
99
                return narrow_integral || multiply_may_overflow;
174
99
            }
175
0
            return false;
176
99
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
123
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
99
            using Types2 = std::decay_t<decltype(types2)>;
125
99
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
99
                using FromFieldType = typename FromDataType::FieldType;
133
99
                using ToFieldType = typename ToDataType::FieldType;
134
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
99
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
99
                UInt32 to_max_digits = 0;
146
99
                UInt32 to_precision = 0;
147
99
                UInt32 to_scale = 0;
148
149
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
99
                    const auto* to_decimal_type =
153
99
                            check_and_get_data_type<ToDataType>(to_type.get());
154
99
                    to_precision = to_decimal_type->get_precision();
155
99
                    ToDataType::check_type_precision(to_precision);
156
157
99
                    to_scale = to_decimal_type->get_scale();
158
99
                    ToDataType::check_type_scale(to_scale);
159
99
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
99
                if (to_scale > from_scale) {
170
66
                    multiply_may_overflow &=
171
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
66
                }
173
99
                return narrow_integral || multiply_may_overflow;
174
99
            }
175
0
            return false;
176
99
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
123
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
168
            using Types2 = std::decay_t<decltype(types2)>;
125
168
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
168
                using FromFieldType = typename FromDataType::FieldType;
133
168
                using ToFieldType = typename ToDataType::FieldType;
134
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
168
                UInt32 from_scale = 0;
136
137
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
168
                    const auto* from_decimal_type =
139
168
                            check_and_get_data_type<FromDataType>(from_type.get());
140
168
                    from_precision =
141
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
168
                    from_scale = from_decimal_type->get_scale();
143
168
                }
144
145
168
                UInt32 to_max_digits = 0;
146
168
                UInt32 to_precision = 0;
147
168
                UInt32 to_scale = 0;
148
149
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
168
                    const auto* to_decimal_type =
153
168
                            check_and_get_data_type<ToDataType>(to_type.get());
154
168
                    to_precision = to_decimal_type->get_precision();
155
168
                    ToDataType::check_type_precision(to_precision);
156
157
168
                    to_scale = to_decimal_type->get_scale();
158
168
                    ToDataType::check_type_scale(to_scale);
159
168
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
168
                if (to_scale > from_scale) {
170
105
                    multiply_may_overflow &=
171
105
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
105
                }
173
168
                return narrow_integral || multiply_may_overflow;
174
168
            }
175
0
            return false;
176
168
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
123
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
272
            using Types2 = std::decay_t<decltype(types2)>;
125
272
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
272
                using FromFieldType = typename FromDataType::FieldType;
133
272
                using ToFieldType = typename ToDataType::FieldType;
134
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
272
                UInt32 from_scale = 0;
136
137
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
272
                    const auto* from_decimal_type =
139
272
                            check_and_get_data_type<FromDataType>(from_type.get());
140
272
                    from_precision =
141
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
272
                    from_scale = from_decimal_type->get_scale();
143
272
                }
144
145
272
                UInt32 to_max_digits = 0;
146
272
                UInt32 to_precision = 0;
147
272
                UInt32 to_scale = 0;
148
149
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
272
                    const auto* to_decimal_type =
153
272
                            check_and_get_data_type<ToDataType>(to_type.get());
154
272
                    to_precision = to_decimal_type->get_precision();
155
272
                    ToDataType::check_type_precision(to_precision);
156
157
272
                    to_scale = to_decimal_type->get_scale();
158
272
                    ToDataType::check_type_scale(to_scale);
159
272
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
272
                if (to_scale > from_scale) {
170
152
                    multiply_may_overflow &=
171
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
152
                }
173
272
                return narrow_integral || multiply_may_overflow;
174
272
            }
175
0
            return false;
176
272
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
123
180
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
180
            using Types2 = std::decay_t<decltype(types2)>;
125
180
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
180
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
180
                using FromFieldType = typename FromDataType::FieldType;
133
180
                using ToFieldType = typename ToDataType::FieldType;
134
180
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
180
                UInt32 from_scale = 0;
136
137
180
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
180
                    const auto* from_decimal_type =
139
180
                            check_and_get_data_type<FromDataType>(from_type.get());
140
180
                    from_precision =
141
180
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
180
                    from_scale = from_decimal_type->get_scale();
143
180
                }
144
145
180
                UInt32 to_max_digits = 0;
146
180
                UInt32 to_precision = 0;
147
180
                UInt32 to_scale = 0;
148
149
180
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
180
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
180
                    const auto* to_decimal_type =
153
180
                            check_and_get_data_type<ToDataType>(to_type.get());
154
180
                    to_precision = to_decimal_type->get_precision();
155
180
                    ToDataType::check_type_precision(to_precision);
156
157
180
                    to_scale = to_decimal_type->get_scale();
158
180
                    ToDataType::check_type_scale(to_scale);
159
180
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
180
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
180
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
180
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
180
                if (to_scale > from_scale) {
170
50
                    multiply_may_overflow &=
171
50
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
50
                }
173
180
                return narrow_integral || multiply_may_overflow;
174
180
            }
175
0
            return false;
176
180
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
123
381
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
381
            using Types2 = std::decay_t<decltype(types2)>;
125
381
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
381
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
381
                using FromFieldType = typename FromDataType::FieldType;
133
381
                using ToFieldType = typename ToDataType::FieldType;
134
381
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
381
                UInt32 from_scale = 0;
136
137
381
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
381
                    const auto* from_decimal_type =
139
381
                            check_and_get_data_type<FromDataType>(from_type.get());
140
381
                    from_precision =
141
381
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
381
                    from_scale = from_decimal_type->get_scale();
143
381
                }
144
145
381
                UInt32 to_max_digits = 0;
146
381
                UInt32 to_precision = 0;
147
381
                UInt32 to_scale = 0;
148
149
381
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
381
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
381
                    const auto* to_decimal_type =
153
381
                            check_and_get_data_type<ToDataType>(to_type.get());
154
381
                    to_precision = to_decimal_type->get_precision();
155
381
                    ToDataType::check_type_precision(to_precision);
156
157
381
                    to_scale = to_decimal_type->get_scale();
158
381
                    ToDataType::check_type_scale(to_scale);
159
381
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
381
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
381
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
381
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
381
                if (to_scale > from_scale) {
170
136
                    multiply_may_overflow &=
171
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
136
                }
173
381
                return narrow_integral || multiply_may_overflow;
174
381
            }
175
0
            return false;
176
381
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Line
Count
Source
123
392
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
392
            using Types2 = std::decay_t<decltype(types2)>;
125
392
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
392
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
392
                using FromFieldType = typename FromDataType::FieldType;
133
392
                using ToFieldType = typename ToDataType::FieldType;
134
392
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
392
                UInt32 from_scale = 0;
136
137
392
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
392
                    const auto* from_decimal_type =
139
392
                            check_and_get_data_type<FromDataType>(from_type.get());
140
392
                    from_precision =
141
392
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
392
                    from_scale = from_decimal_type->get_scale();
143
392
                }
144
145
392
                UInt32 to_max_digits = 0;
146
392
                UInt32 to_precision = 0;
147
392
                UInt32 to_scale = 0;
148
149
392
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
392
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
392
                    const auto* to_decimal_type =
153
392
                            check_and_get_data_type<ToDataType>(to_type.get());
154
392
                    to_precision = to_decimal_type->get_precision();
155
392
                    ToDataType::check_type_precision(to_precision);
156
157
392
                    to_scale = to_decimal_type->get_scale();
158
392
                    ToDataType::check_type_scale(to_scale);
159
392
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
392
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
392
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
392
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
392
                if (to_scale > from_scale) {
170
136
                    multiply_may_overflow &=
171
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
136
                }
173
392
                return narrow_integral || multiply_may_overflow;
174
392
            }
175
0
            return false;
176
392
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
123
1.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1.41k
            using Types2 = std::decay_t<decltype(types2)>;
125
1.41k
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
1.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
1.41k
                return false;
130
1.41k
            }
131
1.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
1.41k
                using FromFieldType = typename FromDataType::FieldType;
133
1.41k
                using ToFieldType = typename ToDataType::FieldType;
134
1.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
1.41k
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
1.41k
                UInt32 to_max_digits = 0;
146
1.41k
                UInt32 to_precision = 0;
147
1.41k
                UInt32 to_scale = 0;
148
149
1.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
1.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
1.41k
                    const auto* to_decimal_type =
153
1.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
1.41k
                    to_precision = to_decimal_type->get_precision();
155
1.41k
                    ToDataType::check_type_precision(to_precision);
156
157
1.41k
                    to_scale = to_decimal_type->get_scale();
158
1.41k
                    ToDataType::check_type_scale(to_scale);
159
1.41k
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
1.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
1.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
1.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
1.41k
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
1.41k
                return narrow_integral || multiply_may_overflow;
174
1.41k
            }
175
0
            return false;
176
1.41k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
123
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
4
            using Types2 = std::decay_t<decltype(types2)>;
125
4
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
4
                using FromFieldType = typename FromDataType::FieldType;
133
4
                using ToFieldType = typename ToDataType::FieldType;
134
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
4
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
4
                UInt32 to_max_digits = 0;
146
4
                UInt32 to_precision = 0;
147
4
                UInt32 to_scale = 0;
148
149
4
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
4
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
4
                    const auto* to_decimal_type =
153
4
                            check_and_get_data_type<ToDataType>(to_type.get());
154
4
                    to_precision = to_decimal_type->get_precision();
155
4
                    ToDataType::check_type_precision(to_precision);
156
157
4
                    to_scale = to_decimal_type->get_scale();
158
4
                    ToDataType::check_type_scale(to_scale);
159
4
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
4
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
4
                if (to_scale > from_scale) {
170
4
                    multiply_may_overflow &=
171
4
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
4
                }
173
4
                return narrow_integral || multiply_may_overflow;
174
4
            }
175
0
            return false;
176
4
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
7
                using FromFieldType = typename FromDataType::FieldType;
133
7
                using ToFieldType = typename ToDataType::FieldType;
134
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
7
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
7
                UInt32 to_max_digits = 0;
146
7
                UInt32 to_precision = 0;
147
7
                UInt32 to_scale = 0;
148
149
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
7
                    const auto* to_decimal_type =
153
7
                            check_and_get_data_type<ToDataType>(to_type.get());
154
7
                    to_precision = to_decimal_type->get_precision();
155
7
                    ToDataType::check_type_precision(to_precision);
156
157
7
                    to_scale = to_decimal_type->get_scale();
158
7
                    ToDataType::check_type_scale(to_scale);
159
7
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
7
                if (to_scale > from_scale) {
170
6
                    multiply_may_overflow &=
171
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
6
                }
173
7
                return narrow_integral || multiply_may_overflow;
174
7
            }
175
0
            return false;
176
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
123
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
29
            using Types2 = std::decay_t<decltype(types2)>;
125
29
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
29
                using FromFieldType = typename FromDataType::FieldType;
133
29
                using ToFieldType = typename ToDataType::FieldType;
134
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
29
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
29
                UInt32 to_max_digits = 0;
146
29
                UInt32 to_precision = 0;
147
29
                UInt32 to_scale = 0;
148
149
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
29
                    const auto* to_decimal_type =
153
29
                            check_and_get_data_type<ToDataType>(to_type.get());
154
29
                    to_precision = to_decimal_type->get_precision();
155
29
                    ToDataType::check_type_precision(to_precision);
156
157
29
                    to_scale = to_decimal_type->get_scale();
158
29
                    ToDataType::check_type_scale(to_scale);
159
29
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
29
                if (to_scale > from_scale) {
170
18
                    multiply_may_overflow &=
171
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
18
                }
173
29
                return narrow_integral || multiply_may_overflow;
174
29
            }
175
0
            return false;
176
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
123
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
29
            using Types2 = std::decay_t<decltype(types2)>;
125
29
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
29
                using FromFieldType = typename FromDataType::FieldType;
133
29
                using ToFieldType = typename ToDataType::FieldType;
134
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
29
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
29
                UInt32 to_max_digits = 0;
146
29
                UInt32 to_precision = 0;
147
29
                UInt32 to_scale = 0;
148
149
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
29
                    const auto* to_decimal_type =
153
29
                            check_and_get_data_type<ToDataType>(to_type.get());
154
29
                    to_precision = to_decimal_type->get_precision();
155
29
                    ToDataType::check_type_precision(to_precision);
156
157
29
                    to_scale = to_decimal_type->get_scale();
158
29
                    ToDataType::check_type_scale(to_scale);
159
29
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
29
                if (to_scale > from_scale) {
170
18
                    multiply_may_overflow &=
171
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
18
                }
173
29
                return narrow_integral || multiply_may_overflow;
174
29
            }
175
0
            return false;
176
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
123
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
29
            using Types2 = std::decay_t<decltype(types2)>;
125
29
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
29
                using FromFieldType = typename FromDataType::FieldType;
133
29
                using ToFieldType = typename ToDataType::FieldType;
134
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
29
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
29
                UInt32 to_max_digits = 0;
146
29
                UInt32 to_precision = 0;
147
29
                UInt32 to_scale = 0;
148
149
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
29
                    const auto* to_decimal_type =
153
29
                            check_and_get_data_type<ToDataType>(to_type.get());
154
29
                    to_precision = to_decimal_type->get_precision();
155
29
                    ToDataType::check_type_precision(to_precision);
156
157
29
                    to_scale = to_decimal_type->get_scale();
158
29
                    ToDataType::check_type_scale(to_scale);
159
29
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
29
                if (to_scale > from_scale) {
170
18
                    multiply_may_overflow &=
171
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
18
                }
173
29
                return narrow_integral || multiply_may_overflow;
174
29
            }
175
0
            return false;
176
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
123
34
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
34
            using Types2 = std::decay_t<decltype(types2)>;
125
34
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
34
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
34
                using FromFieldType = typename FromDataType::FieldType;
133
34
                using ToFieldType = typename ToDataType::FieldType;
134
34
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
34
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
34
                UInt32 to_max_digits = 0;
146
34
                UInt32 to_precision = 0;
147
34
                UInt32 to_scale = 0;
148
149
34
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
34
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
34
                    const auto* to_decimal_type =
153
34
                            check_and_get_data_type<ToDataType>(to_type.get());
154
34
                    to_precision = to_decimal_type->get_precision();
155
34
                    ToDataType::check_type_precision(to_precision);
156
157
34
                    to_scale = to_decimal_type->get_scale();
158
34
                    ToDataType::check_type_scale(to_scale);
159
34
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
34
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
34
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
34
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
34
                if (to_scale > from_scale) {
170
23
                    multiply_may_overflow &=
171
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
23
                }
173
34
                return narrow_integral || multiply_may_overflow;
174
34
            }
175
0
            return false;
176
34
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
123
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
49
            using Types2 = std::decay_t<decltype(types2)>;
125
49
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
49
                using FromFieldType = typename FromDataType::FieldType;
133
49
                using ToFieldType = typename ToDataType::FieldType;
134
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
49
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
49
                UInt32 to_max_digits = 0;
146
49
                UInt32 to_precision = 0;
147
49
                UInt32 to_scale = 0;
148
149
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
49
                    const auto* to_decimal_type =
153
49
                            check_and_get_data_type<ToDataType>(to_type.get());
154
49
                    to_precision = to_decimal_type->get_precision();
155
49
                    ToDataType::check_type_precision(to_precision);
156
157
49
                    to_scale = to_decimal_type->get_scale();
158
49
                    ToDataType::check_type_scale(to_scale);
159
49
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
49
                if (to_scale > from_scale) {
170
28
                    multiply_may_overflow &=
171
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
28
                }
173
49
                return narrow_integral || multiply_may_overflow;
174
49
            }
175
0
            return false;
176
49
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
123
107
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
107
            using Types2 = std::decay_t<decltype(types2)>;
125
107
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
107
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
107
                using FromFieldType = typename FromDataType::FieldType;
133
107
                using ToFieldType = typename ToDataType::FieldType;
134
107
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
107
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
107
                UInt32 to_max_digits = 0;
146
107
                UInt32 to_precision = 0;
147
107
                UInt32 to_scale = 0;
148
149
107
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
107
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
107
                    const auto* to_decimal_type =
153
107
                            check_and_get_data_type<ToDataType>(to_type.get());
154
107
                    to_precision = to_decimal_type->get_precision();
155
107
                    ToDataType::check_type_precision(to_precision);
156
157
107
                    to_scale = to_decimal_type->get_scale();
158
107
                    ToDataType::check_type_scale(to_scale);
159
107
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
107
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
107
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
107
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
107
                if (to_scale > from_scale) {
170
66
                    multiply_may_overflow &=
171
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
66
                }
173
107
                return narrow_integral || multiply_may_overflow;
174
107
            }
175
0
            return false;
176
107
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
123
91
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
91
            using Types2 = std::decay_t<decltype(types2)>;
125
91
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
91
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
91
                using FromFieldType = typename FromDataType::FieldType;
133
91
                using ToFieldType = typename ToDataType::FieldType;
134
91
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
91
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
91
                UInt32 to_max_digits = 0;
146
91
                UInt32 to_precision = 0;
147
91
                UInt32 to_scale = 0;
148
149
91
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
91
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
91
                    const auto* to_decimal_type =
153
91
                            check_and_get_data_type<ToDataType>(to_type.get());
154
91
                    to_precision = to_decimal_type->get_precision();
155
91
                    ToDataType::check_type_precision(to_precision);
156
157
91
                    to_scale = to_decimal_type->get_scale();
158
91
                    ToDataType::check_type_scale(to_scale);
159
91
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
91
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
91
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
91
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
91
                if (to_scale > from_scale) {
170
58
                    multiply_may_overflow &=
171
58
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
58
                }
173
91
                return narrow_integral || multiply_may_overflow;
174
91
            }
175
0
            return false;
176
91
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
123
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
168
            using Types2 = std::decay_t<decltype(types2)>;
125
168
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
168
                using FromFieldType = typename FromDataType::FieldType;
133
168
                using ToFieldType = typename ToDataType::FieldType;
134
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
168
                UInt32 from_scale = 0;
136
137
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
168
                    const auto* from_decimal_type =
139
168
                            check_and_get_data_type<FromDataType>(from_type.get());
140
168
                    from_precision =
141
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
168
                    from_scale = from_decimal_type->get_scale();
143
168
                }
144
145
168
                UInt32 to_max_digits = 0;
146
168
                UInt32 to_precision = 0;
147
168
                UInt32 to_scale = 0;
148
149
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
168
                    const auto* to_decimal_type =
153
168
                            check_and_get_data_type<ToDataType>(to_type.get());
154
168
                    to_precision = to_decimal_type->get_precision();
155
168
                    ToDataType::check_type_precision(to_precision);
156
157
168
                    to_scale = to_decimal_type->get_scale();
158
168
                    ToDataType::check_type_scale(to_scale);
159
168
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
168
                if (to_scale > from_scale) {
170
106
                    multiply_may_overflow &=
171
106
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
106
                }
173
168
                return narrow_integral || multiply_may_overflow;
174
168
            }
175
0
            return false;
176
168
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
123
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
264
            using Types2 = std::decay_t<decltype(types2)>;
125
264
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
264
                using FromFieldType = typename FromDataType::FieldType;
133
264
                using ToFieldType = typename ToDataType::FieldType;
134
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
264
                UInt32 from_scale = 0;
136
137
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
264
                    const auto* from_decimal_type =
139
264
                            check_and_get_data_type<FromDataType>(from_type.get());
140
264
                    from_precision =
141
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
264
                    from_scale = from_decimal_type->get_scale();
143
264
                }
144
145
264
                UInt32 to_max_digits = 0;
146
264
                UInt32 to_precision = 0;
147
264
                UInt32 to_scale = 0;
148
149
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
264
                    const auto* to_decimal_type =
153
264
                            check_and_get_data_type<ToDataType>(to_type.get());
154
264
                    to_precision = to_decimal_type->get_precision();
155
264
                    ToDataType::check_type_precision(to_precision);
156
157
264
                    to_scale = to_decimal_type->get_scale();
158
264
                    ToDataType::check_type_scale(to_scale);
159
264
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
264
                if (to_scale > from_scale) {
170
159
                    multiply_may_overflow &=
171
159
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
159
                }
173
264
                return narrow_integral || multiply_may_overflow;
174
264
            }
175
0
            return false;
176
264
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
123
135
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
135
            using Types2 = std::decay_t<decltype(types2)>;
125
135
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
135
                using FromFieldType = typename FromDataType::FieldType;
133
135
                using ToFieldType = typename ToDataType::FieldType;
134
135
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
135
                UInt32 from_scale = 0;
136
137
135
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
135
                    const auto* from_decimal_type =
139
135
                            check_and_get_data_type<FromDataType>(from_type.get());
140
135
                    from_precision =
141
135
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
135
                    from_scale = from_decimal_type->get_scale();
143
135
                }
144
145
135
                UInt32 to_max_digits = 0;
146
135
                UInt32 to_precision = 0;
147
135
                UInt32 to_scale = 0;
148
149
135
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
135
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
135
                    const auto* to_decimal_type =
153
135
                            check_and_get_data_type<ToDataType>(to_type.get());
154
135
                    to_precision = to_decimal_type->get_precision();
155
135
                    ToDataType::check_type_precision(to_precision);
156
157
135
                    to_scale = to_decimal_type->get_scale();
158
135
                    ToDataType::check_type_scale(to_scale);
159
135
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
135
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
135
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
135
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
135
                if (to_scale > from_scale) {
170
68
                    multiply_may_overflow &=
171
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
68
                }
173
135
                return narrow_integral || multiply_may_overflow;
174
135
            }
175
0
            return false;
176
135
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
123
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
272
            using Types2 = std::decay_t<decltype(types2)>;
125
272
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
272
                using FromFieldType = typename FromDataType::FieldType;
133
272
                using ToFieldType = typename ToDataType::FieldType;
134
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
272
                UInt32 from_scale = 0;
136
137
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
272
                    const auto* from_decimal_type =
139
272
                            check_and_get_data_type<FromDataType>(from_type.get());
140
272
                    from_precision =
141
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
272
                    from_scale = from_decimal_type->get_scale();
143
272
                }
144
145
272
                UInt32 to_max_digits = 0;
146
272
                UInt32 to_precision = 0;
147
272
                UInt32 to_scale = 0;
148
149
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
272
                    const auto* to_decimal_type =
153
272
                            check_and_get_data_type<ToDataType>(to_type.get());
154
272
                    to_precision = to_decimal_type->get_precision();
155
272
                    ToDataType::check_type_precision(to_precision);
156
157
272
                    to_scale = to_decimal_type->get_scale();
158
272
                    ToDataType::check_type_scale(to_scale);
159
272
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
272
                if (to_scale > from_scale) {
170
152
                    multiply_may_overflow &=
171
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
152
                }
173
272
                return narrow_integral || multiply_may_overflow;
174
272
            }
175
0
            return false;
176
272
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Line
Count
Source
123
381
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
381
            using Types2 = std::decay_t<decltype(types2)>;
125
381
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
381
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
381
                using FromFieldType = typename FromDataType::FieldType;
133
381
                using ToFieldType = typename ToDataType::FieldType;
134
381
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
381
                UInt32 from_scale = 0;
136
137
381
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
381
                    const auto* from_decimal_type =
139
381
                            check_and_get_data_type<FromDataType>(from_type.get());
140
381
                    from_precision =
141
381
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
381
                    from_scale = from_decimal_type->get_scale();
143
381
                }
144
145
381
                UInt32 to_max_digits = 0;
146
381
                UInt32 to_precision = 0;
147
381
                UInt32 to_scale = 0;
148
149
381
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
381
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
381
                    const auto* to_decimal_type =
153
381
                            check_and_get_data_type<ToDataType>(to_type.get());
154
381
                    to_precision = to_decimal_type->get_precision();
155
381
                    ToDataType::check_type_precision(to_precision);
156
157
381
                    to_scale = to_decimal_type->get_scale();
158
381
                    ToDataType::check_type_scale(to_scale);
159
381
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
381
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
381
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
381
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
381
                if (to_scale > from_scale) {
170
136
                    multiply_may_overflow &=
171
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
136
                }
173
381
                return narrow_integral || multiply_may_overflow;
174
381
            }
175
0
            return false;
176
381
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
123
1.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1.41k
            using Types2 = std::decay_t<decltype(types2)>;
125
1.41k
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
1.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
1.41k
                return false;
130
1.41k
            }
131
1.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
1.41k
                using FromFieldType = typename FromDataType::FieldType;
133
1.41k
                using ToFieldType = typename ToDataType::FieldType;
134
1.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
1.41k
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
1.41k
                UInt32 to_max_digits = 0;
146
1.41k
                UInt32 to_precision = 0;
147
1.41k
                UInt32 to_scale = 0;
148
149
1.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
1.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
1.41k
                    const auto* to_decimal_type =
153
1.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
1.41k
                    to_precision = to_decimal_type->get_precision();
155
1.41k
                    ToDataType::check_type_precision(to_precision);
156
157
1.41k
                    to_scale = to_decimal_type->get_scale();
158
1.41k
                    ToDataType::check_type_scale(to_scale);
159
1.41k
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
1.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
1.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
1.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
1.41k
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
1.41k
                return narrow_integral || multiply_may_overflow;
174
1.41k
            }
175
0
            return false;
176
1.41k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
7
                using FromFieldType = typename FromDataType::FieldType;
133
7
                using ToFieldType = typename ToDataType::FieldType;
134
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
7
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
7
                UInt32 to_max_digits = 0;
146
7
                UInt32 to_precision = 0;
147
7
                UInt32 to_scale = 0;
148
149
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
7
                    const auto* to_decimal_type =
153
7
                            check_and_get_data_type<ToDataType>(to_type.get());
154
7
                    to_precision = to_decimal_type->get_precision();
155
7
                    ToDataType::check_type_precision(to_precision);
156
157
7
                    to_scale = to_decimal_type->get_scale();
158
7
                    ToDataType::check_type_scale(to_scale);
159
7
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
7
                if (to_scale > from_scale) {
170
6
                    multiply_may_overflow &=
171
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
6
                }
173
7
                return narrow_integral || multiply_may_overflow;
174
7
            }
175
0
            return false;
176
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
123
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
29
            using Types2 = std::decay_t<decltype(types2)>;
125
29
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
29
                using FromFieldType = typename FromDataType::FieldType;
133
29
                using ToFieldType = typename ToDataType::FieldType;
134
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
29
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
29
                UInt32 to_max_digits = 0;
146
29
                UInt32 to_precision = 0;
147
29
                UInt32 to_scale = 0;
148
149
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
29
                    const auto* to_decimal_type =
153
29
                            check_and_get_data_type<ToDataType>(to_type.get());
154
29
                    to_precision = to_decimal_type->get_precision();
155
29
                    ToDataType::check_type_precision(to_precision);
156
157
29
                    to_scale = to_decimal_type->get_scale();
158
29
                    ToDataType::check_type_scale(to_scale);
159
29
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
29
                if (to_scale > from_scale) {
170
18
                    multiply_may_overflow &=
171
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
18
                }
173
29
                return narrow_integral || multiply_may_overflow;
174
29
            }
175
0
            return false;
176
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
123
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
29
            using Types2 = std::decay_t<decltype(types2)>;
125
29
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
29
                using FromFieldType = typename FromDataType::FieldType;
133
29
                using ToFieldType = typename ToDataType::FieldType;
134
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
29
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
29
                UInt32 to_max_digits = 0;
146
29
                UInt32 to_precision = 0;
147
29
                UInt32 to_scale = 0;
148
149
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
29
                    const auto* to_decimal_type =
153
29
                            check_and_get_data_type<ToDataType>(to_type.get());
154
29
                    to_precision = to_decimal_type->get_precision();
155
29
                    ToDataType::check_type_precision(to_precision);
156
157
29
                    to_scale = to_decimal_type->get_scale();
158
29
                    ToDataType::check_type_scale(to_scale);
159
29
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
29
                if (to_scale > from_scale) {
170
18
                    multiply_may_overflow &=
171
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
18
                }
173
29
                return narrow_integral || multiply_may_overflow;
174
29
            }
175
0
            return false;
176
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
123
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
29
            using Types2 = std::decay_t<decltype(types2)>;
125
29
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
29
                using FromFieldType = typename FromDataType::FieldType;
133
29
                using ToFieldType = typename ToDataType::FieldType;
134
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
29
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
29
                UInt32 to_max_digits = 0;
146
29
                UInt32 to_precision = 0;
147
29
                UInt32 to_scale = 0;
148
149
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
29
                    const auto* to_decimal_type =
153
29
                            check_and_get_data_type<ToDataType>(to_type.get());
154
29
                    to_precision = to_decimal_type->get_precision();
155
29
                    ToDataType::check_type_precision(to_precision);
156
157
29
                    to_scale = to_decimal_type->get_scale();
158
29
                    ToDataType::check_type_scale(to_scale);
159
29
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
29
                if (to_scale > from_scale) {
170
18
                    multiply_may_overflow &=
171
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
18
                }
173
29
                return narrow_integral || multiply_may_overflow;
174
29
            }
175
0
            return false;
176
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
123
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
29
            using Types2 = std::decay_t<decltype(types2)>;
125
29
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
29
                using FromFieldType = typename FromDataType::FieldType;
133
29
                using ToFieldType = typename ToDataType::FieldType;
134
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
29
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
29
                UInt32 to_max_digits = 0;
146
29
                UInt32 to_precision = 0;
147
29
                UInt32 to_scale = 0;
148
149
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
29
                    const auto* to_decimal_type =
153
29
                            check_and_get_data_type<ToDataType>(to_type.get());
154
29
                    to_precision = to_decimal_type->get_precision();
155
29
                    ToDataType::check_type_precision(to_precision);
156
157
29
                    to_scale = to_decimal_type->get_scale();
158
29
                    ToDataType::check_type_scale(to_scale);
159
29
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
29
                if (to_scale > from_scale) {
170
18
                    multiply_may_overflow &=
171
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
18
                }
173
29
                return narrow_integral || multiply_may_overflow;
174
29
            }
175
0
            return false;
176
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
123
44
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
44
            using Types2 = std::decay_t<decltype(types2)>;
125
44
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
44
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
44
                using FromFieldType = typename FromDataType::FieldType;
133
44
                using ToFieldType = typename ToDataType::FieldType;
134
44
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
44
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
44
                UInt32 to_max_digits = 0;
146
44
                UInt32 to_precision = 0;
147
44
                UInt32 to_scale = 0;
148
149
44
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
44
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
44
                    const auto* to_decimal_type =
153
44
                            check_and_get_data_type<ToDataType>(to_type.get());
154
44
                    to_precision = to_decimal_type->get_precision();
155
44
                    ToDataType::check_type_precision(to_precision);
156
157
44
                    to_scale = to_decimal_type->get_scale();
158
44
                    ToDataType::check_type_scale(to_scale);
159
44
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
44
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
44
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
44
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
44
                if (to_scale > from_scale) {
170
28
                    multiply_may_overflow &=
171
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
28
                }
173
44
                return narrow_integral || multiply_may_overflow;
174
44
            }
175
0
            return false;
176
44
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
123
87
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
87
            using Types2 = std::decay_t<decltype(types2)>;
125
87
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
87
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
87
                using FromFieldType = typename FromDataType::FieldType;
133
87
                using ToFieldType = typename ToDataType::FieldType;
134
87
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
87
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
87
                UInt32 to_max_digits = 0;
146
87
                UInt32 to_precision = 0;
147
87
                UInt32 to_scale = 0;
148
149
87
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
87
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
87
                    const auto* to_decimal_type =
153
87
                            check_and_get_data_type<ToDataType>(to_type.get());
154
87
                    to_precision = to_decimal_type->get_precision();
155
87
                    ToDataType::check_type_precision(to_precision);
156
157
87
                    to_scale = to_decimal_type->get_scale();
158
87
                    ToDataType::check_type_scale(to_scale);
159
87
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
87
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
87
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
87
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
87
                if (to_scale > from_scale) {
170
66
                    multiply_may_overflow &=
171
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
66
                }
173
87
                return narrow_integral || multiply_may_overflow;
174
87
            }
175
0
            return false;
176
87
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
123
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
99
            using Types2 = std::decay_t<decltype(types2)>;
125
99
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
99
                using FromFieldType = typename FromDataType::FieldType;
133
99
                using ToFieldType = typename ToDataType::FieldType;
134
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
99
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
99
                UInt32 to_max_digits = 0;
146
99
                UInt32 to_precision = 0;
147
99
                UInt32 to_scale = 0;
148
149
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
99
                    const auto* to_decimal_type =
153
99
                            check_and_get_data_type<ToDataType>(to_type.get());
154
99
                    to_precision = to_decimal_type->get_precision();
155
99
                    ToDataType::check_type_precision(to_precision);
156
157
99
                    to_scale = to_decimal_type->get_scale();
158
99
                    ToDataType::check_type_scale(to_scale);
159
99
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
99
                if (to_scale > from_scale) {
170
66
                    multiply_may_overflow &=
171
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
66
                }
173
99
                return narrow_integral || multiply_may_overflow;
174
99
            }
175
0
            return false;
176
99
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
123
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
168
            using Types2 = std::decay_t<decltype(types2)>;
125
168
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
168
                using FromFieldType = typename FromDataType::FieldType;
133
168
                using ToFieldType = typename ToDataType::FieldType;
134
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
168
                UInt32 from_scale = 0;
136
137
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
168
                    const auto* from_decimal_type =
139
168
                            check_and_get_data_type<FromDataType>(from_type.get());
140
168
                    from_precision =
141
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
168
                    from_scale = from_decimal_type->get_scale();
143
168
                }
144
145
168
                UInt32 to_max_digits = 0;
146
168
                UInt32 to_precision = 0;
147
168
                UInt32 to_scale = 0;
148
149
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
168
                    const auto* to_decimal_type =
153
168
                            check_and_get_data_type<ToDataType>(to_type.get());
154
168
                    to_precision = to_decimal_type->get_precision();
155
168
                    ToDataType::check_type_precision(to_precision);
156
157
168
                    to_scale = to_decimal_type->get_scale();
158
168
                    ToDataType::check_type_scale(to_scale);
159
168
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
168
                if (to_scale > from_scale) {
170
106
                    multiply_may_overflow &=
171
106
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
106
                }
173
168
                return narrow_integral || multiply_may_overflow;
174
168
            }
175
0
            return false;
176
168
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
123
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
264
            using Types2 = std::decay_t<decltype(types2)>;
125
264
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
264
                using FromFieldType = typename FromDataType::FieldType;
133
264
                using ToFieldType = typename ToDataType::FieldType;
134
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
264
                UInt32 from_scale = 0;
136
137
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
264
                    const auto* from_decimal_type =
139
264
                            check_and_get_data_type<FromDataType>(from_type.get());
140
264
                    from_precision =
141
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
264
                    from_scale = from_decimal_type->get_scale();
143
264
                }
144
145
264
                UInt32 to_max_digits = 0;
146
264
                UInt32 to_precision = 0;
147
264
                UInt32 to_scale = 0;
148
149
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
264
                    const auto* to_decimal_type =
153
264
                            check_and_get_data_type<ToDataType>(to_type.get());
154
264
                    to_precision = to_decimal_type->get_precision();
155
264
                    ToDataType::check_type_precision(to_precision);
156
157
264
                    to_scale = to_decimal_type->get_scale();
158
264
                    ToDataType::check_type_scale(to_scale);
159
264
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
264
                if (to_scale > from_scale) {
170
160
                    multiply_may_overflow &=
171
160
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
160
                }
173
264
                return narrow_integral || multiply_may_overflow;
174
264
            }
175
0
            return false;
176
264
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
123
132
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
132
            using Types2 = std::decay_t<decltype(types2)>;
125
132
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
132
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
132
                using FromFieldType = typename FromDataType::FieldType;
133
132
                using ToFieldType = typename ToDataType::FieldType;
134
132
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
132
                UInt32 from_scale = 0;
136
137
132
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
132
                    const auto* from_decimal_type =
139
132
                            check_and_get_data_type<FromDataType>(from_type.get());
140
132
                    from_precision =
141
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
132
                    from_scale = from_decimal_type->get_scale();
143
132
                }
144
145
132
                UInt32 to_max_digits = 0;
146
132
                UInt32 to_precision = 0;
147
132
                UInt32 to_scale = 0;
148
149
132
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
132
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
132
                    const auto* to_decimal_type =
153
132
                            check_and_get_data_type<ToDataType>(to_type.get());
154
132
                    to_precision = to_decimal_type->get_precision();
155
132
                    ToDataType::check_type_precision(to_precision);
156
157
132
                    to_scale = to_decimal_type->get_scale();
158
132
                    ToDataType::check_type_scale(to_scale);
159
132
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
132
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
132
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
132
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
132
                if (to_scale > from_scale) {
170
68
                    multiply_may_overflow &=
171
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
68
                }
173
132
                return narrow_integral || multiply_may_overflow;
174
132
            }
175
0
            return false;
176
132
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
123
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
264
            using Types2 = std::decay_t<decltype(types2)>;
125
264
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
264
                using FromFieldType = typename FromDataType::FieldType;
133
264
                using ToFieldType = typename ToDataType::FieldType;
134
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
264
                UInt32 from_scale = 0;
136
137
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
264
                    const auto* from_decimal_type =
139
264
                            check_and_get_data_type<FromDataType>(from_type.get());
140
264
                    from_precision =
141
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
264
                    from_scale = from_decimal_type->get_scale();
143
264
                }
144
145
264
                UInt32 to_max_digits = 0;
146
264
                UInt32 to_precision = 0;
147
264
                UInt32 to_scale = 0;
148
149
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
264
                    const auto* to_decimal_type =
153
264
                            check_and_get_data_type<ToDataType>(to_type.get());
154
264
                    to_precision = to_decimal_type->get_precision();
155
264
                    ToDataType::check_type_precision(to_precision);
156
157
264
                    to_scale = to_decimal_type->get_scale();
158
264
                    ToDataType::check_type_scale(to_scale);
159
264
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
264
                if (to_scale > from_scale) {
170
159
                    multiply_may_overflow &=
171
159
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
159
                }
173
264
                return narrow_integral || multiply_may_overflow;
174
264
            }
175
0
            return false;
176
264
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
123
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
272
            using Types2 = std::decay_t<decltype(types2)>;
125
272
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
272
                using FromFieldType = typename FromDataType::FieldType;
133
272
                using ToFieldType = typename ToDataType::FieldType;
134
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
272
                UInt32 from_scale = 0;
136
137
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
272
                    const auto* from_decimal_type =
139
272
                            check_and_get_data_type<FromDataType>(from_type.get());
140
272
                    from_precision =
141
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
272
                    from_scale = from_decimal_type->get_scale();
143
272
                }
144
145
272
                UInt32 to_max_digits = 0;
146
272
                UInt32 to_precision = 0;
147
272
                UInt32 to_scale = 0;
148
149
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
272
                    const auto* to_decimal_type =
153
272
                            check_and_get_data_type<ToDataType>(to_type.get());
154
272
                    to_precision = to_decimal_type->get_precision();
155
272
                    ToDataType::check_type_precision(to_precision);
156
157
272
                    to_scale = to_decimal_type->get_scale();
158
272
                    ToDataType::check_type_scale(to_scale);
159
272
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
272
                if (to_scale > from_scale) {
170
152
                    multiply_may_overflow &=
171
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
152
                }
173
272
                return narrow_integral || multiply_may_overflow;
174
272
            }
175
0
            return false;
176
272
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
123
1.39k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1.39k
            using Types2 = std::decay_t<decltype(types2)>;
125
1.39k
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
1.39k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
1.39k
                return false;
130
1.39k
            }
131
1.39k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
1.39k
                using FromFieldType = typename FromDataType::FieldType;
133
1.39k
                using ToFieldType = typename ToDataType::FieldType;
134
1.39k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
1.39k
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
1.39k
                UInt32 to_max_digits = 0;
146
1.39k
                UInt32 to_precision = 0;
147
1.39k
                UInt32 to_scale = 0;
148
149
1.39k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
1.39k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
1.39k
                    const auto* to_decimal_type =
153
1.39k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
1.39k
                    to_precision = to_decimal_type->get_precision();
155
1.39k
                    ToDataType::check_type_precision(to_precision);
156
157
1.39k
                    to_scale = to_decimal_type->get_scale();
158
1.39k
                    ToDataType::check_type_scale(to_scale);
159
1.39k
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
1.39k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
1.39k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
1.39k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
1.39k
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
1.39k
                return narrow_integral || multiply_may_overflow;
174
1.39k
            }
175
0
            return false;
176
1.39k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
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
123
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1
            using Types2 = std::decay_t<decltype(types2)>;
125
1
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
1
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
1
                return false;
130
1
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
1
            return false;
176
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7
            return false;
176
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
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7
            return false;
176
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
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
2
                using FromFieldType = typename FromDataType::FieldType;
133
2
                using ToFieldType = typename ToDataType::FieldType;
134
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
2
                UInt32 from_scale = 0;
136
137
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
2
                    const auto* from_decimal_type =
139
2
                            check_and_get_data_type<FromDataType>(from_type.get());
140
2
                    from_precision =
141
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
2
                    from_scale = from_decimal_type->get_scale();
143
2
                }
144
145
2
                UInt32 to_max_digits = 0;
146
2
                UInt32 to_precision = 0;
147
2
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
2
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
2
                return narrow_integral || multiply_may_overflow;
174
2
            }
175
0
            return false;
176
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
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
123
52
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
52
            using Types2 = std::decay_t<decltype(types2)>;
125
52
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
52
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
52
                return false;
130
52
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
52
            return false;
176
52
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7
            return false;
176
7
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
7
            return false;
176
7
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Line
Count
Source
123
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
4
            using Types2 = std::decay_t<decltype(types2)>;
125
4
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
4
                using FromFieldType = typename FromDataType::FieldType;
133
4
                using ToFieldType = typename ToDataType::FieldType;
134
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
4
                UInt32 from_scale = 0;
136
137
4
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
4
                    const auto* from_decimal_type =
139
4
                            check_and_get_data_type<FromDataType>(from_type.get());
140
4
                    from_precision =
141
4
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
4
                    from_scale = from_decimal_type->get_scale();
143
4
                }
144
145
4
                UInt32 to_max_digits = 0;
146
4
                UInt32 to_precision = 0;
147
4
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
4
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
4
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
4
                return narrow_integral || multiply_may_overflow;
174
4
            }
175
0
            return false;
176
4
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Line
Count
Source
123
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2
            using Types2 = std::decay_t<decltype(types2)>;
125
2
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
2
            return false;
176
2
        });
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
123
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1
            using Types2 = std::decay_t<decltype(types2)>;
125
1
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
1
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
1
                return false;
130
1
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
1
            return false;
176
1
        });
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
123
51
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
51
            using Types2 = std::decay_t<decltype(types2)>;
125
51
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
51
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
51
                return false;
130
51
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
51
            return false;
176
51
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
123
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1
            using Types2 = std::decay_t<decltype(types2)>;
125
1
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
1
            return false;
176
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
123
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1
            using Types2 = std::decay_t<decltype(types2)>;
125
1
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
1
            return false;
176
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Line
Count
Source
123
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1
            using Types2 = std::decay_t<decltype(types2)>;
125
1
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
1
                using FromFieldType = typename FromDataType::FieldType;
133
1
                using ToFieldType = typename ToDataType::FieldType;
134
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
1
                UInt32 from_scale = 0;
136
137
1
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
1
                    const auto* from_decimal_type =
139
1
                            check_and_get_data_type<FromDataType>(from_type.get());
140
1
                    from_precision =
141
1
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
1
                    from_scale = from_decimal_type->get_scale();
143
1
                }
144
145
1
                UInt32 to_max_digits = 0;
146
1
                UInt32 to_precision = 0;
147
1
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
1
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
1
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
1
                    to_precision = to_max_digits;
163
1
                }
164
165
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
1
                if (to_scale > from_scale) {
170
0
                    multiply_may_overflow &=
171
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
0
                }
173
1
                return narrow_integral || multiply_may_overflow;
174
1
            }
175
0
            return false;
176
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Line
Count
Source
123
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1
            using Types2 = std::decay_t<decltype(types2)>;
125
1
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
                return false;
130
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
1
            return false;
176
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
123
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
12
            using Types2 = std::decay_t<decltype(types2)>;
125
12
            using FromDataType = typename Types2::LeftType;
126
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
12
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
12
                return false;
130
12
            }
131
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
                using FromFieldType = typename FromDataType::FieldType;
133
                using ToFieldType = typename ToDataType::FieldType;
134
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
                UInt32 from_scale = 0;
136
137
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
                    const auto* from_decimal_type =
139
                            check_and_get_data_type<FromDataType>(from_type.get());
140
                    from_precision =
141
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
                    from_scale = from_decimal_type->get_scale();
143
                }
144
145
                UInt32 to_max_digits = 0;
146
                UInt32 to_precision = 0;
147
                UInt32 to_scale = 0;
148
149
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
                    const auto* to_decimal_type =
153
                            check_and_get_data_type<ToDataType>(to_type.get());
154
                    to_precision = to_decimal_type->get_precision();
155
                    ToDataType::check_type_precision(to_precision);
156
157
                    to_scale = to_decimal_type->get_scale();
158
                    ToDataType::check_type_scale(to_scale);
159
                }
160
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
                    to_precision = to_max_digits;
163
                }
164
165
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
                if (to_scale > from_scale) {
170
                    multiply_may_overflow &=
171
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
                }
173
                return narrow_integral || multiply_may_overflow;
174
            }
175
12
            return false;
176
12
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
177
35.3k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
113
48
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
48
        using Types = std::decay_t<decltype(types)>;
115
48
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
48
        return call_on_index_and_data_type<
123
48
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
48
            using Types2 = std::decay_t<decltype(types2)>;
125
48
            using FromDataType = typename Types2::LeftType;
126
48
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
48
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
48
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
48
                return false;
130
48
            }
131
48
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
48
                using FromFieldType = typename FromDataType::FieldType;
133
48
                using ToFieldType = typename ToDataType::FieldType;
134
48
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
48
                UInt32 from_scale = 0;
136
137
48
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
48
                    const auto* from_decimal_type =
139
48
                            check_and_get_data_type<FromDataType>(from_type.get());
140
48
                    from_precision =
141
48
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
48
                    from_scale = from_decimal_type->get_scale();
143
48
                }
144
145
48
                UInt32 to_max_digits = 0;
146
48
                UInt32 to_precision = 0;
147
48
                UInt32 to_scale = 0;
148
149
48
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
48
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
48
                    const auto* to_decimal_type =
153
48
                            check_and_get_data_type<ToDataType>(to_type.get());
154
48
                    to_precision = to_decimal_type->get_precision();
155
48
                    ToDataType::check_type_precision(to_precision);
156
157
48
                    to_scale = to_decimal_type->get_scale();
158
48
                    ToDataType::check_type_scale(to_scale);
159
48
                }
160
48
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
48
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
48
                    to_precision = to_max_digits;
163
48
                }
164
165
48
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
48
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
48
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
48
                if (to_scale > from_scale) {
170
48
                    multiply_may_overflow &=
171
48
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
48
                }
173
48
                return narrow_integral || multiply_may_overflow;
174
48
            }
175
48
            return false;
176
48
        });
177
48
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
113
1.44k
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
1.44k
        using Types = std::decay_t<decltype(types)>;
115
1.44k
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
1.44k
        return call_on_index_and_data_type<
123
1.44k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1.44k
            using Types2 = std::decay_t<decltype(types2)>;
125
1.44k
            using FromDataType = typename Types2::LeftType;
126
1.44k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
1.44k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
1.44k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
1.44k
                return false;
130
1.44k
            }
131
1.44k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
1.44k
                using FromFieldType = typename FromDataType::FieldType;
133
1.44k
                using ToFieldType = typename ToDataType::FieldType;
134
1.44k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
1.44k
                UInt32 from_scale = 0;
136
137
1.44k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
1.44k
                    const auto* from_decimal_type =
139
1.44k
                            check_and_get_data_type<FromDataType>(from_type.get());
140
1.44k
                    from_precision =
141
1.44k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
1.44k
                    from_scale = from_decimal_type->get_scale();
143
1.44k
                }
144
145
1.44k
                UInt32 to_max_digits = 0;
146
1.44k
                UInt32 to_precision = 0;
147
1.44k
                UInt32 to_scale = 0;
148
149
1.44k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
1.44k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
1.44k
                    const auto* to_decimal_type =
153
1.44k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
1.44k
                    to_precision = to_decimal_type->get_precision();
155
1.44k
                    ToDataType::check_type_precision(to_precision);
156
157
1.44k
                    to_scale = to_decimal_type->get_scale();
158
1.44k
                    ToDataType::check_type_scale(to_scale);
159
1.44k
                }
160
1.44k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
1.44k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
1.44k
                    to_precision = to_max_digits;
163
1.44k
                }
164
165
1.44k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
1.44k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
1.44k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
1.44k
                if (to_scale > from_scale) {
170
1.44k
                    multiply_may_overflow &=
171
1.44k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
1.44k
                }
173
1.44k
                return narrow_integral || multiply_may_overflow;
174
1.44k
            }
175
1.44k
            return false;
176
1.44k
        });
177
1.44k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
113
1.42k
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
1.42k
        using Types = std::decay_t<decltype(types)>;
115
1.42k
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
1.42k
        return call_on_index_and_data_type<
123
1.42k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1.42k
            using Types2 = std::decay_t<decltype(types2)>;
125
1.42k
            using FromDataType = typename Types2::LeftType;
126
1.42k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
1.42k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
1.42k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
1.42k
                return false;
130
1.42k
            }
131
1.42k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
1.42k
                using FromFieldType = typename FromDataType::FieldType;
133
1.42k
                using ToFieldType = typename ToDataType::FieldType;
134
1.42k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
1.42k
                UInt32 from_scale = 0;
136
137
1.42k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
1.42k
                    const auto* from_decimal_type =
139
1.42k
                            check_and_get_data_type<FromDataType>(from_type.get());
140
1.42k
                    from_precision =
141
1.42k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
1.42k
                    from_scale = from_decimal_type->get_scale();
143
1.42k
                }
144
145
1.42k
                UInt32 to_max_digits = 0;
146
1.42k
                UInt32 to_precision = 0;
147
1.42k
                UInt32 to_scale = 0;
148
149
1.42k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
1.42k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
1.42k
                    const auto* to_decimal_type =
153
1.42k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
1.42k
                    to_precision = to_decimal_type->get_precision();
155
1.42k
                    ToDataType::check_type_precision(to_precision);
156
157
1.42k
                    to_scale = to_decimal_type->get_scale();
158
1.42k
                    ToDataType::check_type_scale(to_scale);
159
1.42k
                }
160
1.42k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
1.42k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
1.42k
                    to_precision = to_max_digits;
163
1.42k
                }
164
165
1.42k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
1.42k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
1.42k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
1.42k
                if (to_scale > from_scale) {
170
1.42k
                    multiply_may_overflow &=
171
1.42k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
1.42k
                }
173
1.42k
                return narrow_integral || multiply_may_overflow;
174
1.42k
            }
175
1.42k
            return false;
176
1.42k
        });
177
1.42k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
113
1.31k
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
1.31k
        using Types = std::decay_t<decltype(types)>;
115
1.31k
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
1.31k
        return call_on_index_and_data_type<
123
1.31k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1.31k
            using Types2 = std::decay_t<decltype(types2)>;
125
1.31k
            using FromDataType = typename Types2::LeftType;
126
1.31k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
1.31k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
1.31k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
1.31k
                return false;
130
1.31k
            }
131
1.31k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
1.31k
                using FromFieldType = typename FromDataType::FieldType;
133
1.31k
                using ToFieldType = typename ToDataType::FieldType;
134
1.31k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
1.31k
                UInt32 from_scale = 0;
136
137
1.31k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
1.31k
                    const auto* from_decimal_type =
139
1.31k
                            check_and_get_data_type<FromDataType>(from_type.get());
140
1.31k
                    from_precision =
141
1.31k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
1.31k
                    from_scale = from_decimal_type->get_scale();
143
1.31k
                }
144
145
1.31k
                UInt32 to_max_digits = 0;
146
1.31k
                UInt32 to_precision = 0;
147
1.31k
                UInt32 to_scale = 0;
148
149
1.31k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
1.31k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
1.31k
                    const auto* to_decimal_type =
153
1.31k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
1.31k
                    to_precision = to_decimal_type->get_precision();
155
1.31k
                    ToDataType::check_type_precision(to_precision);
156
157
1.31k
                    to_scale = to_decimal_type->get_scale();
158
1.31k
                    ToDataType::check_type_scale(to_scale);
159
1.31k
                }
160
1.31k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
1.31k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
1.31k
                    to_precision = to_max_digits;
163
1.31k
                }
164
165
1.31k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
1.31k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
1.31k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
1.31k
                if (to_scale > from_scale) {
170
1.31k
                    multiply_may_overflow &=
171
1.31k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
1.31k
                }
173
1.31k
                return narrow_integral || multiply_may_overflow;
174
1.31k
            }
175
1.31k
            return false;
176
1.31k
        });
177
1.31k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
113
1.06k
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
1.06k
        using Types = std::decay_t<decltype(types)>;
115
1.06k
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
1.06k
        return call_on_index_and_data_type<
123
1.06k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1.06k
            using Types2 = std::decay_t<decltype(types2)>;
125
1.06k
            using FromDataType = typename Types2::LeftType;
126
1.06k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
1.06k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
1.06k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
1.06k
                return false;
130
1.06k
            }
131
1.06k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
1.06k
                using FromFieldType = typename FromDataType::FieldType;
133
1.06k
                using ToFieldType = typename ToDataType::FieldType;
134
1.06k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
1.06k
                UInt32 from_scale = 0;
136
137
1.06k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
1.06k
                    const auto* from_decimal_type =
139
1.06k
                            check_and_get_data_type<FromDataType>(from_type.get());
140
1.06k
                    from_precision =
141
1.06k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
1.06k
                    from_scale = from_decimal_type->get_scale();
143
1.06k
                }
144
145
1.06k
                UInt32 to_max_digits = 0;
146
1.06k
                UInt32 to_precision = 0;
147
1.06k
                UInt32 to_scale = 0;
148
149
1.06k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
1.06k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
1.06k
                    const auto* to_decimal_type =
153
1.06k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
1.06k
                    to_precision = to_decimal_type->get_precision();
155
1.06k
                    ToDataType::check_type_precision(to_precision);
156
157
1.06k
                    to_scale = to_decimal_type->get_scale();
158
1.06k
                    ToDataType::check_type_scale(to_scale);
159
1.06k
                }
160
1.06k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
1.06k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
1.06k
                    to_precision = to_max_digits;
163
1.06k
                }
164
165
1.06k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
1.06k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
1.06k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
1.06k
                if (to_scale > from_scale) {
170
1.06k
                    multiply_may_overflow &=
171
1.06k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
1.06k
                }
173
1.06k
                return narrow_integral || multiply_may_overflow;
174
1.06k
            }
175
1.06k
            return false;
176
1.06k
        });
177
1.06k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
113
1.08k
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
1.08k
        using Types = std::decay_t<decltype(types)>;
115
1.08k
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
1.08k
        return call_on_index_and_data_type<
123
1.08k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1.08k
            using Types2 = std::decay_t<decltype(types2)>;
125
1.08k
            using FromDataType = typename Types2::LeftType;
126
1.08k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
1.08k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
1.08k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
1.08k
                return false;
130
1.08k
            }
131
1.08k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
1.08k
                using FromFieldType = typename FromDataType::FieldType;
133
1.08k
                using ToFieldType = typename ToDataType::FieldType;
134
1.08k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
1.08k
                UInt32 from_scale = 0;
136
137
1.08k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
1.08k
                    const auto* from_decimal_type =
139
1.08k
                            check_and_get_data_type<FromDataType>(from_type.get());
140
1.08k
                    from_precision =
141
1.08k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
1.08k
                    from_scale = from_decimal_type->get_scale();
143
1.08k
                }
144
145
1.08k
                UInt32 to_max_digits = 0;
146
1.08k
                UInt32 to_precision = 0;
147
1.08k
                UInt32 to_scale = 0;
148
149
1.08k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
1.08k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
1.08k
                    const auto* to_decimal_type =
153
1.08k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
1.08k
                    to_precision = to_decimal_type->get_precision();
155
1.08k
                    ToDataType::check_type_precision(to_precision);
156
157
1.08k
                    to_scale = to_decimal_type->get_scale();
158
1.08k
                    ToDataType::check_type_scale(to_scale);
159
1.08k
                }
160
1.08k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
1.08k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
1.08k
                    to_precision = to_max_digits;
163
1.08k
                }
164
165
1.08k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
1.08k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
1.08k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
1.08k
                if (to_scale > from_scale) {
170
1.08k
                    multiply_may_overflow &=
171
1.08k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
1.08k
                }
173
1.08k
                return narrow_integral || multiply_may_overflow;
174
1.08k
            }
175
1.08k
            return false;
176
1.08k
        });
177
1.08k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
113
8.17k
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
8.17k
        using Types = std::decay_t<decltype(types)>;
115
8.17k
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
8.17k
        return call_on_index_and_data_type<
123
8.17k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
8.17k
            using Types2 = std::decay_t<decltype(types2)>;
125
8.17k
            using FromDataType = typename Types2::LeftType;
126
8.17k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
8.17k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
8.17k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
8.17k
                return false;
130
8.17k
            }
131
8.17k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
8.17k
                using FromFieldType = typename FromDataType::FieldType;
133
8.17k
                using ToFieldType = typename ToDataType::FieldType;
134
8.17k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
8.17k
                UInt32 from_scale = 0;
136
137
8.17k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
8.17k
                    const auto* from_decimal_type =
139
8.17k
                            check_and_get_data_type<FromDataType>(from_type.get());
140
8.17k
                    from_precision =
141
8.17k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
8.17k
                    from_scale = from_decimal_type->get_scale();
143
8.17k
                }
144
145
8.17k
                UInt32 to_max_digits = 0;
146
8.17k
                UInt32 to_precision = 0;
147
8.17k
                UInt32 to_scale = 0;
148
149
8.17k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
8.17k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
8.17k
                    const auto* to_decimal_type =
153
8.17k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
8.17k
                    to_precision = to_decimal_type->get_precision();
155
8.17k
                    ToDataType::check_type_precision(to_precision);
156
157
8.17k
                    to_scale = to_decimal_type->get_scale();
158
8.17k
                    ToDataType::check_type_scale(to_scale);
159
8.17k
                }
160
8.17k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
8.17k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
8.17k
                    to_precision = to_max_digits;
163
8.17k
                }
164
165
8.17k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
8.17k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
8.17k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
8.17k
                if (to_scale > from_scale) {
170
8.17k
                    multiply_may_overflow &=
171
8.17k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
8.17k
                }
173
8.17k
                return narrow_integral || multiply_may_overflow;
174
8.17k
            }
175
8.17k
            return false;
176
8.17k
        });
177
8.17k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
113
8.24k
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
8.24k
        using Types = std::decay_t<decltype(types)>;
115
8.24k
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
8.24k
        return call_on_index_and_data_type<
123
8.24k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
8.24k
            using Types2 = std::decay_t<decltype(types2)>;
125
8.24k
            using FromDataType = typename Types2::LeftType;
126
8.24k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
8.24k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
8.24k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
8.24k
                return false;
130
8.24k
            }
131
8.24k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
8.24k
                using FromFieldType = typename FromDataType::FieldType;
133
8.24k
                using ToFieldType = typename ToDataType::FieldType;
134
8.24k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
8.24k
                UInt32 from_scale = 0;
136
137
8.24k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
8.24k
                    const auto* from_decimal_type =
139
8.24k
                            check_and_get_data_type<FromDataType>(from_type.get());
140
8.24k
                    from_precision =
141
8.24k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
8.24k
                    from_scale = from_decimal_type->get_scale();
143
8.24k
                }
144
145
8.24k
                UInt32 to_max_digits = 0;
146
8.24k
                UInt32 to_precision = 0;
147
8.24k
                UInt32 to_scale = 0;
148
149
8.24k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
8.24k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
8.24k
                    const auto* to_decimal_type =
153
8.24k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
8.24k
                    to_precision = to_decimal_type->get_precision();
155
8.24k
                    ToDataType::check_type_precision(to_precision);
156
157
8.24k
                    to_scale = to_decimal_type->get_scale();
158
8.24k
                    ToDataType::check_type_scale(to_scale);
159
8.24k
                }
160
8.24k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
8.24k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
8.24k
                    to_precision = to_max_digits;
163
8.24k
                }
164
165
8.24k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
8.24k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
8.24k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
8.24k
                if (to_scale > from_scale) {
170
8.24k
                    multiply_may_overflow &=
171
8.24k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
8.24k
                }
173
8.24k
                return narrow_integral || multiply_may_overflow;
174
8.24k
            }
175
8.24k
            return false;
176
8.24k
        });
177
8.24k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
113
3.23k
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
3.23k
        using Types = std::decay_t<decltype(types)>;
115
3.23k
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
3.23k
        return call_on_index_and_data_type<
123
3.23k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
3.23k
            using Types2 = std::decay_t<decltype(types2)>;
125
3.23k
            using FromDataType = typename Types2::LeftType;
126
3.23k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
3.23k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
3.23k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
3.23k
                return false;
130
3.23k
            }
131
3.23k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
3.23k
                using FromFieldType = typename FromDataType::FieldType;
133
3.23k
                using ToFieldType = typename ToDataType::FieldType;
134
3.23k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
3.23k
                UInt32 from_scale = 0;
136
137
3.23k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
3.23k
                    const auto* from_decimal_type =
139
3.23k
                            check_and_get_data_type<FromDataType>(from_type.get());
140
3.23k
                    from_precision =
141
3.23k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
3.23k
                    from_scale = from_decimal_type->get_scale();
143
3.23k
                }
144
145
3.23k
                UInt32 to_max_digits = 0;
146
3.23k
                UInt32 to_precision = 0;
147
3.23k
                UInt32 to_scale = 0;
148
149
3.23k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
3.23k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
3.23k
                    const auto* to_decimal_type =
153
3.23k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
3.23k
                    to_precision = to_decimal_type->get_precision();
155
3.23k
                    ToDataType::check_type_precision(to_precision);
156
157
3.23k
                    to_scale = to_decimal_type->get_scale();
158
3.23k
                    ToDataType::check_type_scale(to_scale);
159
3.23k
                }
160
3.23k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
3.23k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
3.23k
                    to_precision = to_max_digits;
163
3.23k
                }
164
165
3.23k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
3.23k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
3.23k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
3.23k
                if (to_scale > from_scale) {
170
3.23k
                    multiply_may_overflow &=
171
3.23k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
3.23k
                }
173
3.23k
                return narrow_integral || multiply_may_overflow;
174
3.23k
            }
175
3.23k
            return false;
176
3.23k
        });
177
3.23k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
113
3.21k
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
3.21k
        using Types = std::decay_t<decltype(types)>;
115
3.21k
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
3.21k
        return call_on_index_and_data_type<
123
3.21k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
3.21k
            using Types2 = std::decay_t<decltype(types2)>;
125
3.21k
            using FromDataType = typename Types2::LeftType;
126
3.21k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
3.21k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
3.21k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
3.21k
                return false;
130
3.21k
            }
131
3.21k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
3.21k
                using FromFieldType = typename FromDataType::FieldType;
133
3.21k
                using ToFieldType = typename ToDataType::FieldType;
134
3.21k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
3.21k
                UInt32 from_scale = 0;
136
137
3.21k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
3.21k
                    const auto* from_decimal_type =
139
3.21k
                            check_and_get_data_type<FromDataType>(from_type.get());
140
3.21k
                    from_precision =
141
3.21k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
3.21k
                    from_scale = from_decimal_type->get_scale();
143
3.21k
                }
144
145
3.21k
                UInt32 to_max_digits = 0;
146
3.21k
                UInt32 to_precision = 0;
147
3.21k
                UInt32 to_scale = 0;
148
149
3.21k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
3.21k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
3.21k
                    const auto* to_decimal_type =
153
3.21k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
3.21k
                    to_precision = to_decimal_type->get_precision();
155
3.21k
                    ToDataType::check_type_precision(to_precision);
156
157
3.21k
                    to_scale = to_decimal_type->get_scale();
158
3.21k
                    ToDataType::check_type_scale(to_scale);
159
3.21k
                }
160
3.21k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
3.21k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
3.21k
                    to_precision = to_max_digits;
163
3.21k
                }
164
165
3.21k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
3.21k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
3.21k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
3.21k
                if (to_scale > from_scale) {
170
3.21k
                    multiply_may_overflow &=
171
3.21k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
3.21k
                }
173
3.21k
                return narrow_integral || multiply_may_overflow;
174
3.21k
            }
175
3.21k
            return false;
176
3.21k
        });
177
3.21k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
113
4
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
4
        using Types = std::decay_t<decltype(types)>;
115
4
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
4
        return call_on_index_and_data_type<
123
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
4
            using Types2 = std::decay_t<decltype(types2)>;
125
4
            using FromDataType = typename Types2::LeftType;
126
4
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
4
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
4
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
4
                return false;
130
4
            }
131
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
4
                using FromFieldType = typename FromDataType::FieldType;
133
4
                using ToFieldType = typename ToDataType::FieldType;
134
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
4
                UInt32 from_scale = 0;
136
137
4
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
4
                    const auto* from_decimal_type =
139
4
                            check_and_get_data_type<FromDataType>(from_type.get());
140
4
                    from_precision =
141
4
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
4
                    from_scale = from_decimal_type->get_scale();
143
4
                }
144
145
4
                UInt32 to_max_digits = 0;
146
4
                UInt32 to_precision = 0;
147
4
                UInt32 to_scale = 0;
148
149
4
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
4
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
4
                    const auto* to_decimal_type =
153
4
                            check_and_get_data_type<ToDataType>(to_type.get());
154
4
                    to_precision = to_decimal_type->get_precision();
155
4
                    ToDataType::check_type_precision(to_precision);
156
157
4
                    to_scale = to_decimal_type->get_scale();
158
4
                    ToDataType::check_type_scale(to_scale);
159
4
                }
160
4
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
4
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
4
                    to_precision = to_max_digits;
163
4
                }
164
165
4
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
4
                if (to_scale > from_scale) {
170
4
                    multiply_may_overflow &=
171
4
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
4
                }
173
4
                return narrow_integral || multiply_may_overflow;
174
4
            }
175
4
            return false;
176
4
        });
177
4
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
113
3.01k
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
3.01k
        using Types = std::decay_t<decltype(types)>;
115
3.01k
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
3.01k
        return call_on_index_and_data_type<
123
3.01k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
3.01k
            using Types2 = std::decay_t<decltype(types2)>;
125
3.01k
            using FromDataType = typename Types2::LeftType;
126
3.01k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
3.01k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
3.01k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
3.01k
                return false;
130
3.01k
            }
131
3.01k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
3.01k
                using FromFieldType = typename FromDataType::FieldType;
133
3.01k
                using ToFieldType = typename ToDataType::FieldType;
134
3.01k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
3.01k
                UInt32 from_scale = 0;
136
137
3.01k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
3.01k
                    const auto* from_decimal_type =
139
3.01k
                            check_and_get_data_type<FromDataType>(from_type.get());
140
3.01k
                    from_precision =
141
3.01k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
3.01k
                    from_scale = from_decimal_type->get_scale();
143
3.01k
                }
144
145
3.01k
                UInt32 to_max_digits = 0;
146
3.01k
                UInt32 to_precision = 0;
147
3.01k
                UInt32 to_scale = 0;
148
149
3.01k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
3.01k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
3.01k
                    const auto* to_decimal_type =
153
3.01k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
3.01k
                    to_precision = to_decimal_type->get_precision();
155
3.01k
                    ToDataType::check_type_precision(to_precision);
156
157
3.01k
                    to_scale = to_decimal_type->get_scale();
158
3.01k
                    ToDataType::check_type_scale(to_scale);
159
3.01k
                }
160
3.01k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
3.01k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
3.01k
                    to_precision = to_max_digits;
163
3.01k
                }
164
165
3.01k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
3.01k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
3.01k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
3.01k
                if (to_scale > from_scale) {
170
3.01k
                    multiply_may_overflow &=
171
3.01k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
3.01k
                }
173
3.01k
                return narrow_integral || multiply_may_overflow;
174
3.01k
            }
175
3.01k
            return false;
176
3.01k
        });
177
3.01k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_
Line
Count
Source
113
2.84k
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
2.84k
        using Types = std::decay_t<decltype(types)>;
115
2.84k
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
2.84k
        return call_on_index_and_data_type<
123
2.84k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
2.84k
            using Types2 = std::decay_t<decltype(types2)>;
125
2.84k
            using FromDataType = typename Types2::LeftType;
126
2.84k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
2.84k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
2.84k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
2.84k
                return false;
130
2.84k
            }
131
2.84k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
2.84k
                using FromFieldType = typename FromDataType::FieldType;
133
2.84k
                using ToFieldType = typename ToDataType::FieldType;
134
2.84k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
2.84k
                UInt32 from_scale = 0;
136
137
2.84k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
2.84k
                    const auto* from_decimal_type =
139
2.84k
                            check_and_get_data_type<FromDataType>(from_type.get());
140
2.84k
                    from_precision =
141
2.84k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
2.84k
                    from_scale = from_decimal_type->get_scale();
143
2.84k
                }
144
145
2.84k
                UInt32 to_max_digits = 0;
146
2.84k
                UInt32 to_precision = 0;
147
2.84k
                UInt32 to_scale = 0;
148
149
2.84k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
2.84k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
2.84k
                    const auto* to_decimal_type =
153
2.84k
                            check_and_get_data_type<ToDataType>(to_type.get());
154
2.84k
                    to_precision = to_decimal_type->get_precision();
155
2.84k
                    ToDataType::check_type_precision(to_precision);
156
157
2.84k
                    to_scale = to_decimal_type->get_scale();
158
2.84k
                    ToDataType::check_type_scale(to_scale);
159
2.84k
                }
160
2.84k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
2.84k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
2.84k
                    to_precision = to_max_digits;
163
2.84k
                }
164
165
2.84k
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
2.84k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
2.84k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
2.84k
                if (to_scale > from_scale) {
170
2.84k
                    multiply_may_overflow &=
171
2.84k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
2.84k
                }
173
2.84k
                return narrow_integral || multiply_may_overflow;
174
2.84k
            }
175
2.84k
            return false;
176
2.84k
        });
177
2.84k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_
Line
Count
Source
113
1
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
1
        using Types = std::decay_t<decltype(types)>;
115
1
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
1
        return call_on_index_and_data_type<
123
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
1
            using Types2 = std::decay_t<decltype(types2)>;
125
1
            using FromDataType = typename Types2::LeftType;
126
1
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
1
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
1
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
1
                return false;
130
1
            }
131
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
1
                using FromFieldType = typename FromDataType::FieldType;
133
1
                using ToFieldType = typename ToDataType::FieldType;
134
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
1
                UInt32 from_scale = 0;
136
137
1
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
1
                    const auto* from_decimal_type =
139
1
                            check_and_get_data_type<FromDataType>(from_type.get());
140
1
                    from_precision =
141
1
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
1
                    from_scale = from_decimal_type->get_scale();
143
1
                }
144
145
1
                UInt32 to_max_digits = 0;
146
1
                UInt32 to_precision = 0;
147
1
                UInt32 to_scale = 0;
148
149
1
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
1
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
1
                    const auto* to_decimal_type =
153
1
                            check_and_get_data_type<ToDataType>(to_type.get());
154
1
                    to_precision = to_decimal_type->get_precision();
155
1
                    ToDataType::check_type_precision(to_precision);
156
157
1
                    to_scale = to_decimal_type->get_scale();
158
1
                    ToDataType::check_type_scale(to_scale);
159
1
                }
160
1
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
1
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
1
                    to_precision = to_max_digits;
163
1
                }
164
165
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
1
                if (to_scale > from_scale) {
170
1
                    multiply_may_overflow &=
171
1
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
1
                }
173
1
                return narrow_integral || multiply_may_overflow;
174
1
            }
175
1
            return false;
176
1
        });
177
1
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_
Line
Count
Source
113
72
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
72
        using Types = std::decay_t<decltype(types)>;
115
72
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
72
        return call_on_index_and_data_type<
123
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
72
            using Types2 = std::decay_t<decltype(types2)>;
125
72
            using FromDataType = typename Types2::LeftType;
126
72
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
72
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
72
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
72
                return false;
130
72
            }
131
72
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
72
                using FromFieldType = typename FromDataType::FieldType;
133
72
                using ToFieldType = typename ToDataType::FieldType;
134
72
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
72
                UInt32 from_scale = 0;
136
137
72
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
72
                    const auto* from_decimal_type =
139
72
                            check_and_get_data_type<FromDataType>(from_type.get());
140
72
                    from_precision =
141
72
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
72
                    from_scale = from_decimal_type->get_scale();
143
72
                }
144
145
72
                UInt32 to_max_digits = 0;
146
72
                UInt32 to_precision = 0;
147
72
                UInt32 to_scale = 0;
148
149
72
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
72
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
72
                    const auto* to_decimal_type =
153
72
                            check_and_get_data_type<ToDataType>(to_type.get());
154
72
                    to_precision = to_decimal_type->get_precision();
155
72
                    ToDataType::check_type_precision(to_precision);
156
157
72
                    to_scale = to_decimal_type->get_scale();
158
72
                    ToDataType::check_type_scale(to_scale);
159
72
                }
160
72
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
72
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
72
                    to_precision = to_max_digits;
163
72
                }
164
165
72
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
72
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
72
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
72
                if (to_scale > from_scale) {
170
72
                    multiply_may_overflow &=
171
72
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
72
                }
173
72
                return narrow_integral || multiply_may_overflow;
174
72
            }
175
72
            return false;
176
72
        });
177
72
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
113
74
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
74
        using Types = std::decay_t<decltype(types)>;
115
74
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
74
        return call_on_index_and_data_type<
123
74
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
74
            using Types2 = std::decay_t<decltype(types2)>;
125
74
            using FromDataType = typename Types2::LeftType;
126
74
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
74
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
74
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
74
                return false;
130
74
            }
131
74
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
74
                using FromFieldType = typename FromDataType::FieldType;
133
74
                using ToFieldType = typename ToDataType::FieldType;
134
74
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
74
                UInt32 from_scale = 0;
136
137
74
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
74
                    const auto* from_decimal_type =
139
74
                            check_and_get_data_type<FromDataType>(from_type.get());
140
74
                    from_precision =
141
74
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
74
                    from_scale = from_decimal_type->get_scale();
143
74
                }
144
145
74
                UInt32 to_max_digits = 0;
146
74
                UInt32 to_precision = 0;
147
74
                UInt32 to_scale = 0;
148
149
74
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
74
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
74
                    const auto* to_decimal_type =
153
74
                            check_and_get_data_type<ToDataType>(to_type.get());
154
74
                    to_precision = to_decimal_type->get_precision();
155
74
                    ToDataType::check_type_precision(to_precision);
156
157
74
                    to_scale = to_decimal_type->get_scale();
158
74
                    ToDataType::check_type_scale(to_scale);
159
74
                }
160
74
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
74
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
74
                    to_precision = to_max_digits;
163
74
                }
164
165
74
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
74
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
74
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
74
                if (to_scale > from_scale) {
170
74
                    multiply_may_overflow &=
171
74
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
74
                }
173
74
                return narrow_integral || multiply_may_overflow;
174
74
            }
175
74
            return false;
176
74
        });
177
74
    };
Unexecuted instantiation: function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_
Line
Count
Source
113
16
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
16
        using Types = std::decay_t<decltype(types)>;
115
16
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
            return false;
121
        }
122
16
        return call_on_index_and_data_type<
123
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
16
            using Types2 = std::decay_t<decltype(types2)>;
125
16
            using FromDataType = typename Types2::LeftType;
126
16
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
16
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
16
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
16
                return false;
130
16
            }
131
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
16
                using FromFieldType = typename FromDataType::FieldType;
133
16
                using ToFieldType = typename ToDataType::FieldType;
134
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
16
                UInt32 from_scale = 0;
136
137
16
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
16
                    const auto* from_decimal_type =
139
16
                            check_and_get_data_type<FromDataType>(from_type.get());
140
16
                    from_precision =
141
16
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
16
                    from_scale = from_decimal_type->get_scale();
143
16
                }
144
145
16
                UInt32 to_max_digits = 0;
146
16
                UInt32 to_precision = 0;
147
16
                UInt32 to_scale = 0;
148
149
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
16
                    const auto* to_decimal_type =
153
16
                            check_and_get_data_type<ToDataType>(to_type.get());
154
16
                    to_precision = to_decimal_type->get_precision();
155
16
                    ToDataType::check_type_precision(to_precision);
156
157
16
                    to_scale = to_decimal_type->get_scale();
158
16
                    ToDataType::check_type_scale(to_scale);
159
16
                }
160
16
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
16
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
16
                    to_precision = to_max_digits;
163
16
                }
164
165
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
16
                if (to_scale > from_scale) {
170
16
                    multiply_may_overflow &=
171
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
16
                }
173
16
                return narrow_integral || multiply_may_overflow;
174
16
            }
175
16
            return false;
176
16
        });
177
16
    };
Unexecuted instantiation: function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_
Line
Count
Source
113
7
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
7
        using Types = std::decay_t<decltype(types)>;
115
7
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
7
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
7
            return false;
121
7
        }
122
0
        return call_on_index_and_data_type<
123
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
7
            using Types2 = std::decay_t<decltype(types2)>;
125
7
            using FromDataType = typename Types2::LeftType;
126
7
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
7
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
7
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
7
                return false;
130
7
            }
131
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
7
                using FromFieldType = typename FromDataType::FieldType;
133
7
                using ToFieldType = typename ToDataType::FieldType;
134
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
7
                UInt32 from_scale = 0;
136
137
7
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
7
                    const auto* from_decimal_type =
139
7
                            check_and_get_data_type<FromDataType>(from_type.get());
140
7
                    from_precision =
141
7
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
7
                    from_scale = from_decimal_type->get_scale();
143
7
                }
144
145
7
                UInt32 to_max_digits = 0;
146
7
                UInt32 to_precision = 0;
147
7
                UInt32 to_scale = 0;
148
149
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
7
                    const auto* to_decimal_type =
153
7
                            check_and_get_data_type<ToDataType>(to_type.get());
154
7
                    to_precision = to_decimal_type->get_precision();
155
7
                    ToDataType::check_type_precision(to_precision);
156
157
7
                    to_scale = to_decimal_type->get_scale();
158
7
                    ToDataType::check_type_scale(to_scale);
159
7
                }
160
7
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
7
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
7
                    to_precision = to_max_digits;
163
7
                }
164
165
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
7
                if (to_scale > from_scale) {
170
7
                    multiply_may_overflow &=
171
7
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
7
                }
173
7
                return narrow_integral || multiply_may_overflow;
174
7
            }
175
7
            return false;
176
7
        });
177
7
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_
Line
Count
Source
113
10
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
10
        using Types = std::decay_t<decltype(types)>;
115
10
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
10
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
10
            return false;
121
10
        }
122
0
        return call_on_index_and_data_type<
123
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
10
            using Types2 = std::decay_t<decltype(types2)>;
125
10
            using FromDataType = typename Types2::LeftType;
126
10
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
10
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
10
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
10
                return false;
130
10
            }
131
10
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
10
                using FromFieldType = typename FromDataType::FieldType;
133
10
                using ToFieldType = typename ToDataType::FieldType;
134
10
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
10
                UInt32 from_scale = 0;
136
137
10
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
10
                    const auto* from_decimal_type =
139
10
                            check_and_get_data_type<FromDataType>(from_type.get());
140
10
                    from_precision =
141
10
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
10
                    from_scale = from_decimal_type->get_scale();
143
10
                }
144
145
10
                UInt32 to_max_digits = 0;
146
10
                UInt32 to_precision = 0;
147
10
                UInt32 to_scale = 0;
148
149
10
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
10
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
10
                    const auto* to_decimal_type =
153
10
                            check_and_get_data_type<ToDataType>(to_type.get());
154
10
                    to_precision = to_decimal_type->get_precision();
155
10
                    ToDataType::check_type_precision(to_precision);
156
157
10
                    to_scale = to_decimal_type->get_scale();
158
10
                    ToDataType::check_type_scale(to_scale);
159
10
                }
160
10
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
10
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
10
                    to_precision = to_max_digits;
163
10
                }
164
165
10
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
10
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
10
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
10
                if (to_scale > from_scale) {
170
10
                    multiply_may_overflow &=
171
10
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
10
                }
173
10
                return narrow_integral || multiply_may_overflow;
174
10
            }
175
10
            return false;
176
10
        });
177
10
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_
Line
Count
Source
113
46
    auto make_default_wrapper = [&](const auto& types) -> bool {
114
46
        using Types = std::decay_t<decltype(types)>;
115
46
        using ToDataType = typename Types::LeftType;
116
117
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
118
                        IsDatelikeV2Types<ToDataType> ||
119
46
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
120
46
            return false;
121
46
        }
122
0
        return call_on_index_and_data_type<
123
46
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
124
46
            using Types2 = std::decay_t<decltype(types2)>;
125
46
            using FromDataType = typename Types2::LeftType;
126
46
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
127
46
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
128
46
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
129
46
                return false;
130
46
            }
131
46
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
132
46
                using FromFieldType = typename FromDataType::FieldType;
133
46
                using ToFieldType = typename ToDataType::FieldType;
134
46
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
135
46
                UInt32 from_scale = 0;
136
137
46
                if constexpr (IsDataTypeDecimal<FromDataType>) {
138
46
                    const auto* from_decimal_type =
139
46
                            check_and_get_data_type<FromDataType>(from_type.get());
140
46
                    from_precision =
141
46
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
142
46
                    from_scale = from_decimal_type->get_scale();
143
46
                }
144
145
46
                UInt32 to_max_digits = 0;
146
46
                UInt32 to_precision = 0;
147
46
                UInt32 to_scale = 0;
148
149
46
                if constexpr (IsDataTypeDecimal<ToDataType>) {
150
46
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
151
152
46
                    const auto* to_decimal_type =
153
46
                            check_and_get_data_type<ToDataType>(to_type.get());
154
46
                    to_precision = to_decimal_type->get_precision();
155
46
                    ToDataType::check_type_precision(to_precision);
156
157
46
                    to_scale = to_decimal_type->get_scale();
158
46
                    ToDataType::check_type_scale(to_scale);
159
46
                }
160
46
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
161
46
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
162
46
                    to_precision = to_max_digits;
163
46
                }
164
165
46
                bool narrow_integral = context->check_overflow_for_decimal() &&
166
46
                                       (to_precision - to_scale) <= (from_precision - from_scale);
167
168
46
                bool multiply_may_overflow = context->check_overflow_for_decimal();
169
46
                if (to_scale > from_scale) {
170
46
                    multiply_may_overflow &=
171
46
                            (from_precision + to_scale - from_scale) >= to_max_digits;
172
46
                }
173
46
                return narrow_integral || multiply_may_overflow;
174
46
            }
175
46
            return false;
176
46
        });
177
46
    };
178
179
85.2k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
180
85.4k
}
181
182
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
183
85.4k
                                    const DataTypePtr& to_type) {
184
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
185
85.4k
    bool result_is_nullable = to_type->is_nullable();
186
187
85.4k
    if (result_is_nullable) {
188
85.4k
        return [from_type, to_type](FunctionContext* context, Block& block,
189
85.4k
                                    const ColumnNumbers& arguments, uint32_t result,
190
85.4k
                                    size_t input_rows_count,
191
85.4k
                                    const NullMap::value_type* null_map = nullptr) {
192
85.4k
            auto from_type_not_nullable = remove_nullable(from_type);
193
85.4k
            auto to_type_not_nullable = remove_nullable(to_type);
194
195
85.4k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
196
85.4k
                    context, from_type_not_nullable, to_type_not_nullable);
197
198
85.4k
            auto nested_result_index = block.columns();
199
85.4k
            block.insert(block.get_by_position(result).unnest_nullable());
200
85.4k
            auto nested_source_index = block.columns();
201
85.4k
            block.insert(block.get_by_position(arguments[0])
202
85.4k
                                 .unnest_nullable(replace_null_data_to_default));
203
204
85.4k
            const auto& arg_col = block.get_by_position(arguments[0]);
205
85.4k
            const NullMap::value_type* arg_null_map = nullptr;
206
85.4k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
207
85.3k
                arg_null_map = nullable->get_null_map_data().data();
208
85.3k
            }
209
85.4k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
210
85.4k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
211
85.4k
                    arg_null_map));
212
213
61.7k
            block.get_by_position(result).column =
214
61.7k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
215
61.7k
                                     arguments, input_rows_count);
216
217
61.7k
            block.erase(nested_source_index);
218
61.7k
            block.erase(nested_result_index);
219
61.7k
            return Status::OK();
220
85.4k
        };
221
85.4k
    } else {
222
29
        return prepare_impl(context, from_type, to_type);
223
29
    }
224
85.4k
}
225
226
/// 'from_type' and 'to_type' are nested types in case of Nullable.
227
/// 'requested_result_is_nullable' is true if CAST to Nullable type is requested.
228
// NOLINTNEXTLINE(readability-function-size)
229
WrapperType prepare_impl(FunctionContext* context, const DataTypePtr& origin_from_type,
230
85.4k
                         const DataTypePtr& origin_to_type) {
231
85.4k
    auto to_type = get_serialized_type(origin_to_type);
232
85.4k
    auto from_type = get_serialized_type(origin_from_type);
233
85.4k
    if (from_type->equals(*to_type)) {
234
141
        return create_identity_wrapper(from_type);
235
141
    }
236
237
85.3k
    const auto* from_variant_v1 =
238
85.3k
            dynamic_cast<const DataTypeVariant*>(remove_nullable(from_type).get());
239
85.3k
    const auto* to_variant_v1 =
240
85.3k
            dynamic_cast<const DataTypeVariant*>(remove_nullable(to_type).get());
241
85.3k
    const auto* from_variant_v2 =
242
85.3k
            dynamic_cast<const DataTypeVariantV2*>(remove_nullable(from_type).get());
243
85.3k
    const auto* to_variant_v2 =
244
85.3k
            dynamic_cast<const DataTypeVariantV2*>(remove_nullable(to_type).get());
245
85.3k
    if ((from_variant_v1 != nullptr && to_variant_v2 != nullptr) ||
246
85.3k
        (from_variant_v2 != nullptr && to_variant_v1 != nullptr)) {
247
0
        return CastWrapper::create_unsupport_wrapper(
248
0
                "Cast between legacy Variant and compute-only Variant V2 is not supported");
249
0
    }
250
251
    // variant needs to be judged first
252
85.3k
    if (to_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
253
3
        if (to_variant_v2 != nullptr) {
254
0
            return create_cast_to_variant_v2_wrapper(from_type);
255
0
        }
256
3
        DORIS_CHECK(to_variant_v1 != nullptr);
257
3
        return create_cast_to_variant_wrapper(from_type, *to_variant_v1);
258
3
    }
259
85.3k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
260
23
        if (from_variant_v2 != nullptr) {
261
0
            auto wrapper = create_cast_from_variant_v2_wrapper(to_type);
262
0
            return [wrapper = std::move(wrapper)](
263
0
                           FunctionContext* context, Block& block, const ColumnNumbers& arguments,
264
0
                           uint32_t result, size_t rows, const NullMap::value_type* null_map) {
265
0
                RETURN_IF_ERROR(wrapper(context, block, arguments, result, rows, null_map));
266
0
                auto& result_column = block.get_by_position(result).column;
267
0
                if (null_map == nullptr) {
268
0
                    const auto* nullable = check_and_get_column<ColumnNullable>(*result_column);
269
0
                    if (nullable != nullptr && !nullable->has_null()) {
270
0
                        result_column = nullable->get_nested_column_ptr();
271
0
                    }
272
0
                }
273
0
                return Status::OK();
274
0
            };
275
0
        }
276
23
        DORIS_CHECK(from_variant_v1 != nullptr);
277
23
        return create_cast_from_variant_wrapper(*from_variant_v1, to_type);
278
23
    }
279
280
85.3k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
281
114
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
282
114
                                              to_type,
283
114
                                              context ? context->jsonb_string_as_string() : false);
284
114
    }
285
286
85.1k
    switch (to_type->get_primitive_type()) {
287
32
    case PrimitiveType::TYPE_BOOLEAN:
288
32
        return create_boolean_wrapper(context, from_type);
289
1.42k
    case PrimitiveType::TYPE_TINYINT:
290
2.83k
    case PrimitiveType::TYPE_SMALLINT:
291
4.13k
    case PrimitiveType::TYPE_INT:
292
5.18k
    case PrimitiveType::TYPE_BIGINT:
293
6.27k
    case PrimitiveType::TYPE_LARGEINT:
294
6.27k
        return create_int_wrapper(context, from_type, to_type->get_primitive_type());
295
8.17k
    case PrimitiveType::TYPE_FLOAT:
296
16.4k
    case PrimitiveType::TYPE_DOUBLE:
297
16.4k
        return create_float_wrapper(context, from_type, to_type->get_primitive_type());
298
1
    case PrimitiveType::TYPE_DATE:
299
1
    case PrimitiveType::TYPE_DATETIME:
300
73
    case PrimitiveType::TYPE_DATEV2:
301
147
    case PrimitiveType::TYPE_DATETIMEV2:
302
163
    case PrimitiveType::TYPE_TIMEV2:
303
163
        return create_datelike_wrapper(context, from_type, to_type->get_primitive_type());
304
0
    case PrimitiveType::TYPE_TIMESTAMPTZ:
305
0
        return create_timestamptz_wrapper(context, from_type);
306
7
    case PrimitiveType::TYPE_IPV4:
307
17
    case PrimitiveType::TYPE_IPV6:
308
17
        return create_ip_wrapper(context, from_type, to_type->get_primitive_type());
309
4
    case PrimitiveType::TYPE_DECIMALV2:
310
3.23k
    case PrimitiveType::TYPE_DECIMAL32:
311
6.45k
    case PrimitiveType::TYPE_DECIMAL64:
312
9.46k
    case PrimitiveType::TYPE_DECIMAL128I:
313
12.3k
    case PrimitiveType::TYPE_DECIMAL256:
314
12.3k
        return create_decimal_wrapper(context, from_type, to_type->get_primitive_type());
315
0
    case PrimitiveType::TYPE_CHAR:
316
0
    case PrimitiveType::TYPE_VARCHAR:
317
23
    case PrimitiveType::TYPE_STRING:
318
23
        return create_string_wrapper(from_type);
319
1.49k
    case PrimitiveType::TYPE_ARRAY:
320
1.49k
        return create_array_wrapper(context, from_type,
321
1.49k
                                    static_cast<const DataTypeArray&>(*to_type));
322
2
    case PrimitiveType::TYPE_STRUCT:
323
2
        return create_struct_wrapper(context, from_type,
324
2
                                     static_cast<const DataTypeStruct&>(*to_type));
325
3
    case PrimitiveType::TYPE_MAP:
326
3
        return create_map_wrapper(context, from_type, static_cast<const DataTypeMap&>(*to_type));
327
0
    case PrimitiveType::TYPE_HLL:
328
0
        return create_hll_wrapper(context, from_type, static_cast<const DataTypeHLL&>(*to_type));
329
0
    case PrimitiveType::TYPE_BITMAP:
330
0
        return create_bitmap_wrapper(context, from_type,
331
0
                                     static_cast<const DataTypeBitMap&>(*to_type));
332
0
    case PrimitiveType::TYPE_QUANTILE_STATE:
333
0
        return create_quantile_state_wrapper(context, from_type,
334
0
                                             static_cast<const DataTypeQuantileState&>(*to_type));
335
48.4k
    case PrimitiveType::TYPE_JSONB:
336
48.4k
        return create_cast_to_jsonb_wrapper(from_type, static_cast<const DataTypeJsonb&>(*to_type),
337
48.4k
                                            context ? context->string_as_jsonb_string() : false);
338
0
    case PrimitiveType::TYPE_VARBINARY:
339
0
        return create_varbinary_wrapper(from_type);
340
0
    default:
341
0
        break;
342
85.1k
    }
343
344
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
345
85.1k
}
346
347
} // namespace CastWrapper
348
349
class PreparedFunctionCast : public PreparedFunctionImpl {
350
public:
351
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
352
83.9k
            : wrapper_function(std::move(wrapper_function_)), name(name_) {}
353
354
0
    String get_name() const override { return name; }
355
356
protected:
357
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
358
83.9k
                        uint32_t result, size_t input_rows_count) const override {
359
83.9k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
360
83.9k
    }
361
362
83.9k
    bool use_default_implementation_for_nulls() const override { return false; }
363
83.9k
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {1}; }
364
365
private:
366
    CastWrapper::WrapperType wrapper_function;
367
    const char* name;
368
};
369
370
class FunctionCast final : public IFunctionBase {
371
public:
372
    FunctionCast(const char* name_, DataTypes argument_types_, DataTypePtr return_type_)
373
84.7k
            : name(name_),
374
84.7k
              argument_types(std::move(argument_types_)),
375
84.7k
              return_type(std::move(return_type_)) {}
376
377
83.9k
    const DataTypes& get_argument_types() const override { return argument_types; }
378
83.9k
    const DataTypePtr& get_return_type() const override { return return_type; }
379
380
    PreparedFunctionPtr prepare(FunctionContext* context, const Block& /*sample_block*/,
381
                                const ColumnNumbers& /*arguments*/,
382
83.9k
                                uint32_t /*result*/) const override {
383
83.9k
        return std::make_shared<PreparedFunctionCast>(
384
83.9k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
385
83.9k
                                                         get_return_type()),
386
83.9k
                name);
387
83.9k
    }
388
389
0
    String get_name() const override { return name; }
390
391
0
    bool is_use_default_implementation_for_constants() const override { return true; }
392
393
private:
394
    const char* name = nullptr;
395
396
    DataTypes argument_types;
397
    DataTypePtr return_type;
398
};
399
400
class FunctionBuilderCast : public FunctionBuilderImpl {
401
public:
402
    static constexpr auto name = "CAST";
403
84.7k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
404
405
84.7k
    FunctionBuilderCast() = default;
406
407
1
    String get_name() const override { return name; }
408
409
0
    size_t get_number_of_arguments() const override { return 2; }
410
411
0
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {1}; }
412
413
protected:
414
    FunctionBasePtr build_impl(const ColumnsWithTypeAndName& arguments,
415
84.7k
                               const DataTypePtr& return_type) const override {
416
84.7k
        DataTypes data_types(arguments.size());
417
418
254k
        for (size_t i = 0; i < arguments.size(); ++i) {
419
169k
            data_types[i] = arguments[i].type;
420
169k
        }
421
422
84.7k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
423
84.7k
    }
424
425
84.7k
    bool skip_return_type_check() const override { return true; }
426
0
    DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override {
427
0
        return nullptr;
428
0
    }
429
430
0
    bool use_default_implementation_for_nulls() const override { return false; }
431
};
432
433
1
void register_function_cast(SimpleFunctionFactory& factory) {
434
1
    factory.register_function<FunctionBuilderCast>();
435
1
}
436
} // namespace doris