Coverage Report

Created: 2026-07-15 03:26

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/primitive_type.h"
25
#include "exprs/function/cast/cast_to_array.h"
26
#include "exprs/function/cast/cast_to_jsonb.h"
27
#include "exprs/function/cast/cast_to_map.h"
28
#include "exprs/function/cast/cast_to_struct.h"
29
#include "exprs/function/cast/cast_to_variant.h"
30
#include "exprs/function/cast/cast_variant_v2.h"
31
#include "exprs/function/cast/cast_wrapper_decls.h"
32
#include "exprs/function/simple_function_factory.h"
33
#include "exprs/variant_v2_execution.h"
34
35
namespace doris {
36
37
namespace CastWrapper {
38
39
WrapperType create_hll_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
40
0
                               const DataTypeHLL& to_type) {
41
    /// Conversion from String through parsing.
42
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
43
0
        return cast_from_string_to_generic;
44
0
    }
45
46
0
    return CastWrapper::create_unsupport_wrapper("Cast to HLL only support from String type");
47
0
}
48
49
WrapperType create_bitmap_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
50
0
                                  const DataTypeBitMap& to_type) {
51
    /// Conversion from String through parsing.
52
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
53
0
        return cast_from_string_to_generic;
54
0
    }
55
56
0
    return CastWrapper::create_unsupport_wrapper("Cast to BitMap only support from String type");
57
0
}
58
59
WrapperType create_quantile_state_wrapper(FunctionContext* context,
60
                                          const DataTypePtr& from_type_untyped,
61
0
                                          const DataTypeQuantileState& to_type) {
62
    /// Conversion from String through parsing.
63
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
64
0
        return cast_from_string_to_generic;
65
0
    }
66
67
0
    return CastWrapper::create_unsupport_wrapper(
68
0
            "Cast to QuantileState only support from String type");
69
0
}
70
71
0
WrapperType create_varbinary_wrapper(const DataTypePtr& from_type_untyped) {
72
    /// Conversion from String through parsing.
73
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
74
0
        return cast_from_string_to_generic;
75
0
    }
76
77
0
    return CastWrapper::create_unsupport_wrapper("Cast to Varbinary only support from String type");
78
0
}
79
80
WrapperType prepare_unpack_dictionaries(FunctionContext* context, const DataTypePtr& from_type,
81
85.4k
                                        const DataTypePtr& to_type) {
82
85.4k
    const auto& from_nested = from_type;
83
85.4k
    const auto& to_nested = to_type;
84
85
85.4k
    if (from_type->is_null_literal()) {
86
0
        if (!to_nested->is_nullable()) {
87
0
            return CastWrapper::create_unsupport_wrapper(
88
0
                    "Cannot convert NULL to a non-nullable type");
89
0
        }
90
91
0
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
92
0
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
93
            /// TODO: remove this in the future.
94
0
            auto& res = block.get_by_position(result);
95
0
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
96
0
                                 ->convert_to_full_column_if_const();
97
0
            return Status::OK();
98
0
        };
99
0
    }
100
101
85.4k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
102
103
85.4k
    return wrapper;
104
85.4k
}
105
106
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
107
85.4k
                                       const DataTypePtr& to_type) {
108
85.4k
    if (from_type->equals(*to_type)) {
109
132
        return false;
110
132
    }
111
112
85.3k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
35.3k
        using Types = std::decay_t<decltype(types)>;
114
35.3k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
60
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
60
            return false;
120
60
        }
121
0
        return call_on_index_and_data_type<
122
35.3k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
35.1k
            using Types2 = std::decay_t<decltype(types2)>;
124
35.1k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
10.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
10.2k
                return false;
129
10.2k
            }
130
12.8k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
12.8k
                using FromFieldType = typename FromDataType::FieldType;
132
12.8k
                using ToFieldType = typename ToDataType::FieldType;
133
12.8k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
12.8k
                UInt32 from_scale = 0;
135
136
12.8k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
5.46k
                    const auto* from_decimal_type =
138
5.46k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
5.46k
                    from_precision =
140
5.46k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
5.46k
                    from_scale = from_decimal_type->get_scale();
142
5.46k
                }
143
144
12.8k
                UInt32 to_max_digits = 0;
145
12.8k
                UInt32 to_precision = 0;
146
12.8k
                UInt32 to_scale = 0;
147
148
12.8k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
12.3k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
12.3k
                    const auto* to_decimal_type =
152
12.3k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
12.3k
                    to_precision = to_decimal_type->get_precision();
154
12.3k
                    ToDataType::check_type_precision(to_precision);
155
156
12.3k
                    to_scale = to_decimal_type->get_scale();
157
12.3k
                    ToDataType::check_type_scale(to_scale);
158
12.3k
                }
159
12.8k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
577
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
577
                    to_precision = to_max_digits;
162
577
                }
163
164
12.8k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
12.8k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
12.8k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
12.8k
                if (to_scale > from_scale) {
169
3.13k
                    multiply_may_overflow &=
170
3.13k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
3.13k
                }
172
12.8k
                return narrow_integral || multiply_may_overflow;
173
12.8k
            }
174
0
            return false;
175
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
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2
                using FromFieldType = typename FromDataType::FieldType;
132
2
                using ToFieldType = typename ToDataType::FieldType;
133
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2
                UInt32 from_scale = 0;
135
136
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
2
                    const auto* from_decimal_type =
138
2
                            check_and_get_data_type<FromDataType>(from_type.get());
139
2
                    from_precision =
140
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
2
                    from_scale = from_decimal_type->get_scale();
142
2
                }
143
144
2
                UInt32 to_max_digits = 0;
145
2
                UInt32 to_precision = 0;
146
2
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
2
                    to_precision = to_max_digits;
162
2
                }
163
164
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
2
                return narrow_integral || multiply_may_overflow;
173
2
            }
174
0
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2
                using FromFieldType = typename FromDataType::FieldType;
132
2
                using ToFieldType = typename ToDataType::FieldType;
133
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2
                UInt32 from_scale = 0;
135
136
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
2
                    const auto* from_decimal_type =
138
2
                            check_and_get_data_type<FromDataType>(from_type.get());
139
2
                    from_precision =
140
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
2
                    from_scale = from_decimal_type->get_scale();
142
2
                }
143
144
2
                UInt32 to_max_digits = 0;
145
2
                UInt32 to_precision = 0;
146
2
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
2
                    to_precision = to_max_digits;
162
2
                }
163
164
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
2
                return narrow_integral || multiply_may_overflow;
173
2
            }
174
0
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2
                using FromFieldType = typename FromDataType::FieldType;
132
2
                using ToFieldType = typename ToDataType::FieldType;
133
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2
                UInt32 from_scale = 0;
135
136
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
2
                    const auto* from_decimal_type =
138
2
                            check_and_get_data_type<FromDataType>(from_type.get());
139
2
                    from_precision =
140
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
2
                    from_scale = from_decimal_type->get_scale();
142
2
                }
143
144
2
                UInt32 to_max_digits = 0;
145
2
                UInt32 to_precision = 0;
146
2
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
2
                    to_precision = to_max_digits;
162
2
                }
163
164
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
2
                return narrow_integral || multiply_may_overflow;
173
2
            }
174
0
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2
                using FromFieldType = typename FromDataType::FieldType;
132
2
                using ToFieldType = typename ToDataType::FieldType;
133
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2
                UInt32 from_scale = 0;
135
136
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
2
                    const auto* from_decimal_type =
138
2
                            check_and_get_data_type<FromDataType>(from_type.get());
139
2
                    from_precision =
140
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
2
                    from_scale = from_decimal_type->get_scale();
142
2
                }
143
144
2
                UInt32 to_max_digits = 0;
145
2
                UInt32 to_precision = 0;
146
2
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
2
                    to_precision = to_max_digits;
162
2
                }
163
164
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
2
                return narrow_integral || multiply_may_overflow;
173
2
            }
174
0
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2
                using FromFieldType = typename FromDataType::FieldType;
132
2
                using ToFieldType = typename ToDataType::FieldType;
133
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2
                UInt32 from_scale = 0;
135
136
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
2
                    const auto* from_decimal_type =
138
2
                            check_and_get_data_type<FromDataType>(from_type.get());
139
2
                    from_precision =
140
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
2
                    from_scale = from_decimal_type->get_scale();
142
2
                }
143
144
2
                UInt32 to_max_digits = 0;
145
2
                UInt32 to_precision = 0;
146
2
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
2
                    to_precision = to_max_digits;
162
2
                }
163
164
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
2
                return narrow_integral || multiply_may_overflow;
173
2
            }
174
0
            return false;
175
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
122
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
12
            using Types2 = std::decay_t<decltype(types2)>;
124
12
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
12
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
12
                return false;
129
12
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
12
            return false;
175
12
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
23
            using Types2 = std::decay_t<decltype(types2)>;
124
23
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
23
            return false;
175
23
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
27
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
27
            using Types2 = std::decay_t<decltype(types2)>;
124
27
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
27
            return false;
175
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
122
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
14
            using Types2 = std::decay_t<decltype(types2)>;
124
14
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
14
                using FromFieldType = typename FromDataType::FieldType;
132
14
                using ToFieldType = typename ToDataType::FieldType;
133
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
14
                UInt32 from_scale = 0;
135
136
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
14
                    const auto* from_decimal_type =
138
14
                            check_and_get_data_type<FromDataType>(from_type.get());
139
14
                    from_precision =
140
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
14
                    from_scale = from_decimal_type->get_scale();
142
14
                }
143
144
14
                UInt32 to_max_digits = 0;
145
14
                UInt32 to_precision = 0;
146
14
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
14
                    to_precision = to_max_digits;
162
14
                }
163
164
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
14
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
14
                return narrow_integral || multiply_may_overflow;
173
14
            }
174
0
            return false;
175
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
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
8
                using FromFieldType = typename FromDataType::FieldType;
132
8
                using ToFieldType = typename ToDataType::FieldType;
133
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
8
                UInt32 from_scale = 0;
135
136
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
8
                    const auto* from_decimal_type =
138
8
                            check_and_get_data_type<FromDataType>(from_type.get());
139
8
                    from_precision =
140
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
8
                    from_scale = from_decimal_type->get_scale();
142
8
                }
143
144
8
                UInt32 to_max_digits = 0;
145
8
                UInt32 to_precision = 0;
146
8
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
8
                    to_precision = to_max_digits;
162
8
                }
163
164
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
8
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
8
                return narrow_integral || multiply_may_overflow;
173
8
            }
174
0
            return false;
175
8
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
122
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
72
            using Types2 = std::decay_t<decltype(types2)>;
124
72
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
72
            return false;
175
72
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
122
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
24
            using Types2 = std::decay_t<decltype(types2)>;
124
24
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
24
            return false;
175
24
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
122
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
320
            using Types2 = std::decay_t<decltype(types2)>;
124
320
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
320
            return false;
175
320
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
122
857
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
857
            using Types2 = std::decay_t<decltype(types2)>;
124
857
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
857
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
857
                return false;
129
857
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
857
            return false;
175
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
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
21
            using Types2 = std::decay_t<decltype(types2)>;
124
21
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
21
            return false;
175
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
25
            using Types2 = std::decay_t<decltype(types2)>;
124
25
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
25
            return false;
175
25
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
122
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
14
            using Types2 = std::decay_t<decltype(types2)>;
124
14
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
14
                using FromFieldType = typename FromDataType::FieldType;
132
14
                using ToFieldType = typename ToDataType::FieldType;
133
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
14
                UInt32 from_scale = 0;
135
136
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
14
                    const auto* from_decimal_type =
138
14
                            check_and_get_data_type<FromDataType>(from_type.get());
139
14
                    from_precision =
140
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
14
                    from_scale = from_decimal_type->get_scale();
142
14
                }
143
144
14
                UInt32 to_max_digits = 0;
145
14
                UInt32 to_precision = 0;
146
14
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
14
                    to_precision = to_max_digits;
162
14
                }
163
164
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
14
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
14
                return narrow_integral || multiply_may_overflow;
173
14
            }
174
0
            return false;
175
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
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
8
                using FromFieldType = typename FromDataType::FieldType;
132
8
                using ToFieldType = typename ToDataType::FieldType;
133
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
8
                UInt32 from_scale = 0;
135
136
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
8
                    const auto* from_decimal_type =
138
8
                            check_and_get_data_type<FromDataType>(from_type.get());
139
8
                    from_precision =
140
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
8
                    from_scale = from_decimal_type->get_scale();
142
8
                }
143
144
8
                UInt32 to_max_digits = 0;
145
8
                UInt32 to_precision = 0;
146
8
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
8
                    to_precision = to_max_digits;
162
8
                }
163
164
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
8
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
8
                return narrow_integral || multiply_may_overflow;
173
8
            }
174
0
            return false;
175
8
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
122
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
72
            using Types2 = std::decay_t<decltype(types2)>;
124
72
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
72
            return false;
175
72
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
122
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
24
            using Types2 = std::decay_t<decltype(types2)>;
124
24
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
24
            return false;
175
24
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
122
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
320
            using Types2 = std::decay_t<decltype(types2)>;
124
320
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
320
            return false;
175
320
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
122
841
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
841
            using Types2 = std::decay_t<decltype(types2)>;
124
841
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
841
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
841
                return false;
129
841
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
841
            return false;
175
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
122
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
4
            using Types2 = std::decay_t<decltype(types2)>;
124
4
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
4
            return false;
175
4
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
122
38
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
38
            using Types2 = std::decay_t<decltype(types2)>;
124
38
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
38
            return false;
175
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
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
17
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
17
            using Types2 = std::decay_t<decltype(types2)>;
124
17
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
17
            return false;
175
17
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
21
            using Types2 = std::decay_t<decltype(types2)>;
124
21
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
21
            return false;
175
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
122
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
14
            using Types2 = std::decay_t<decltype(types2)>;
124
14
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
14
                using FromFieldType = typename FromDataType::FieldType;
132
14
                using ToFieldType = typename ToDataType::FieldType;
133
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
14
                UInt32 from_scale = 0;
135
136
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
14
                    const auto* from_decimal_type =
138
14
                            check_and_get_data_type<FromDataType>(from_type.get());
139
14
                    from_precision =
140
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
14
                    from_scale = from_decimal_type->get_scale();
142
14
                }
143
144
14
                UInt32 to_max_digits = 0;
145
14
                UInt32 to_precision = 0;
146
14
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
14
                    to_precision = to_max_digits;
162
14
                }
163
164
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
14
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
14
                return narrow_integral || multiply_may_overflow;
173
14
            }
174
0
            return false;
175
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
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
8
                using FromFieldType = typename FromDataType::FieldType;
132
8
                using ToFieldType = typename ToDataType::FieldType;
133
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
8
                UInt32 from_scale = 0;
135
136
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
8
                    const auto* from_decimal_type =
138
8
                            check_and_get_data_type<FromDataType>(from_type.get());
139
8
                    from_precision =
140
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
8
                    from_scale = from_decimal_type->get_scale();
142
8
                }
143
144
8
                UInt32 to_max_digits = 0;
145
8
                UInt32 to_precision = 0;
146
8
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
8
                    to_precision = to_max_digits;
162
8
                }
163
164
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
8
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
8
                return narrow_integral || multiply_may_overflow;
173
8
            }
174
0
            return false;
175
8
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
122
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
24
            using Types2 = std::decay_t<decltype(types2)>;
124
24
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
24
            return false;
175
24
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
122
276
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
276
            using Types2 = std::decay_t<decltype(types2)>;
124
276
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
276
            return false;
175
276
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
122
827
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
827
            using Types2 = std::decay_t<decltype(types2)>;
124
827
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
827
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
827
                return false;
129
827
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
827
            return false;
175
827
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
122
75
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
75
            using Types2 = std::decay_t<decltype(types2)>;
124
75
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
75
            return false;
175
75
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
8
            return false;
175
8
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
13
            using Types2 = std::decay_t<decltype(types2)>;
124
13
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
13
            return false;
175
13
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
17
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
17
            using Types2 = std::decay_t<decltype(types2)>;
124
17
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
17
            return false;
175
17
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
122
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
14
            using Types2 = std::decay_t<decltype(types2)>;
124
14
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
14
                using FromFieldType = typename FromDataType::FieldType;
132
14
                using ToFieldType = typename ToDataType::FieldType;
133
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
14
                UInt32 from_scale = 0;
135
136
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
14
                    const auto* from_decimal_type =
138
14
                            check_and_get_data_type<FromDataType>(from_type.get());
139
14
                    from_precision =
140
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
14
                    from_scale = from_decimal_type->get_scale();
142
14
                }
143
144
14
                UInt32 to_max_digits = 0;
145
14
                UInt32 to_precision = 0;
146
14
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
14
                    to_precision = to_max_digits;
162
14
                }
163
164
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
14
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
14
                return narrow_integral || multiply_may_overflow;
173
14
            }
174
0
            return false;
175
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
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
8
                using FromFieldType = typename FromDataType::FieldType;
132
8
                using ToFieldType = typename ToDataType::FieldType;
133
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
8
                UInt32 from_scale = 0;
135
136
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
8
                    const auto* from_decimal_type =
138
8
                            check_and_get_data_type<FromDataType>(from_type.get());
139
8
                    from_precision =
140
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
8
                    from_scale = from_decimal_type->get_scale();
142
8
                }
143
144
8
                UInt32 to_max_digits = 0;
145
8
                UInt32 to_precision = 0;
146
8
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
8
                    to_precision = to_max_digits;
162
8
                }
163
164
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
8
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
8
                return narrow_integral || multiply_may_overflow;
173
8
            }
174
0
            return false;
175
8
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
8
            return false;
175
8
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
122
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
4
            using Types2 = std::decay_t<decltype(types2)>;
124
4
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
4
            return false;
175
4
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
122
809
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
809
            using Types2 = std::decay_t<decltype(types2)>;
124
809
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
809
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
809
                return false;
129
809
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
809
            return false;
175
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
122
97
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
97
            using Types2 = std::decay_t<decltype(types2)>;
124
97
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
97
            return false;
175
97
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
122
95
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
95
            using Types2 = std::decay_t<decltype(types2)>;
124
95
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
95
            return false;
175
95
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
9
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
9
            using Types2 = std::decay_t<decltype(types2)>;
124
9
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
9
            return false;
175
9
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
13
            using Types2 = std::decay_t<decltype(types2)>;
124
13
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
13
            return false;
175
13
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
122
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
14
            using Types2 = std::decay_t<decltype(types2)>;
124
14
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
14
                using FromFieldType = typename FromDataType::FieldType;
132
14
                using ToFieldType = typename ToDataType::FieldType;
133
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
14
                UInt32 from_scale = 0;
135
136
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
14
                    const auto* from_decimal_type =
138
14
                            check_and_get_data_type<FromDataType>(from_type.get());
139
14
                    from_precision =
140
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
14
                    from_scale = from_decimal_type->get_scale();
142
14
                }
143
144
14
                UInt32 to_max_digits = 0;
145
14
                UInt32 to_precision = 0;
146
14
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
14
                    to_precision = to_max_digits;
162
14
                }
163
164
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
14
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
14
                return narrow_integral || multiply_may_overflow;
173
14
            }
174
0
            return false;
175
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
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
8
                using FromFieldType = typename FromDataType::FieldType;
132
8
                using ToFieldType = typename ToDataType::FieldType;
133
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
8
                UInt32 from_scale = 0;
135
136
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
8
                    const auto* from_decimal_type =
138
8
                            check_and_get_data_type<FromDataType>(from_type.get());
139
8
                    from_precision =
140
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
8
                    from_scale = from_decimal_type->get_scale();
142
8
                }
143
144
8
                UInt32 to_max_digits = 0;
145
8
                UInt32 to_precision = 0;
146
8
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
8
                    to_precision = to_max_digits;
162
8
                }
163
164
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
8
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
8
                return narrow_integral || multiply_may_overflow;
173
8
            }
174
0
            return false;
175
8
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
122
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8
            using Types2 = std::decay_t<decltype(types2)>;
124
8
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
8
            return false;
175
8
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
122
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
4
            using Types2 = std::decay_t<decltype(types2)>;
124
4
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
4
            return false;
175
4
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
122
793
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
793
            using Types2 = std::decay_t<decltype(types2)>;
124
793
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
793
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
793
                return false;
129
793
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
793
            return false;
175
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
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
122
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
14
            using Types2 = std::decay_t<decltype(types2)>;
124
14
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
14
                using FromFieldType = typename FromDataType::FieldType;
132
14
                using ToFieldType = typename ToDataType::FieldType;
133
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
14
                UInt32 from_scale = 0;
135
136
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
14
                    const auto* from_decimal_type =
138
14
                            check_and_get_data_type<FromDataType>(from_type.get());
139
14
                    from_precision =
140
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
14
                    from_scale = from_decimal_type->get_scale();
142
14
                }
143
144
14
                UInt32 to_max_digits = 0;
145
14
                UInt32 to_precision = 0;
146
14
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
14
                    to_precision = to_max_digits;
162
14
                }
163
164
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
14
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
14
                return narrow_integral || multiply_may_overflow;
173
14
            }
174
0
            return false;
175
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
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
16
            using Types2 = std::decay_t<decltype(types2)>;
124
16
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
16
                using FromFieldType = typename FromDataType::FieldType;
132
16
                using ToFieldType = typename ToDataType::FieldType;
133
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
16
                UInt32 from_scale = 0;
135
136
16
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
16
                    const auto* from_decimal_type =
138
16
                            check_and_get_data_type<FromDataType>(from_type.get());
139
16
                    from_precision =
140
16
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
16
                    from_scale = from_decimal_type->get_scale();
142
16
                }
143
144
16
                UInt32 to_max_digits = 0;
145
16
                UInt32 to_precision = 0;
146
16
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
16
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
16
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
16
                    to_precision = to_max_digits;
162
16
                }
163
164
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
16
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
16
                return narrow_integral || multiply_may_overflow;
173
16
            }
174
0
            return false;
175
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
122
36
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
36
            using Types2 = std::decay_t<decltype(types2)>;
124
36
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
36
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
36
                using FromFieldType = typename FromDataType::FieldType;
132
36
                using ToFieldType = typename ToDataType::FieldType;
133
36
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
36
                UInt32 from_scale = 0;
135
136
36
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
36
                    const auto* from_decimal_type =
138
36
                            check_and_get_data_type<FromDataType>(from_type.get());
139
36
                    from_precision =
140
36
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
36
                    from_scale = from_decimal_type->get_scale();
142
36
                }
143
144
36
                UInt32 to_max_digits = 0;
145
36
                UInt32 to_precision = 0;
146
36
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
36
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
36
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
36
                    to_precision = to_max_digits;
162
36
                }
163
164
36
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
36
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
36
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
36
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
36
                return narrow_integral || multiply_may_overflow;
173
36
            }
174
0
            return false;
175
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
122
37
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
37
            using Types2 = std::decay_t<decltype(types2)>;
124
37
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
37
            return false;
175
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
122
7.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7.78k
            using Types2 = std::decay_t<decltype(types2)>;
124
7.78k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7.78k
            return false;
175
7.78k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
122
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
162
            using Types2 = std::decay_t<decltype(types2)>;
124
162
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
162
            return false;
175
162
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
122
80
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
80
            using Types2 = std::decay_t<decltype(types2)>;
124
80
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
80
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
80
                return false;
129
80
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
80
            return false;
175
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
122
66
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
66
            using Types2 = std::decay_t<decltype(types2)>;
124
66
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
66
            return false;
175
66
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
122
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
14
            using Types2 = std::decay_t<decltype(types2)>;
124
14
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
14
                using FromFieldType = typename FromDataType::FieldType;
132
14
                using ToFieldType = typename ToDataType::FieldType;
133
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
14
                UInt32 from_scale = 0;
135
136
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
14
                    const auto* from_decimal_type =
138
14
                            check_and_get_data_type<FromDataType>(from_type.get());
139
14
                    from_precision =
140
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
14
                    from_scale = from_decimal_type->get_scale();
142
14
                }
143
144
14
                UInt32 to_max_digits = 0;
145
14
                UInt32 to_precision = 0;
146
14
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
14
                    to_precision = to_max_digits;
162
14
                }
163
164
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
14
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
14
                return narrow_integral || multiply_may_overflow;
173
14
            }
174
0
            return false;
175
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
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
122
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
16
            using Types2 = std::decay_t<decltype(types2)>;
124
16
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
16
                using FromFieldType = typename FromDataType::FieldType;
132
16
                using ToFieldType = typename ToDataType::FieldType;
133
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
16
                UInt32 from_scale = 0;
135
136
16
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
16
                    const auto* from_decimal_type =
138
16
                            check_and_get_data_type<FromDataType>(from_type.get());
139
16
                    from_precision =
140
16
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
16
                    from_scale = from_decimal_type->get_scale();
142
16
                }
143
144
16
                UInt32 to_max_digits = 0;
145
16
                UInt32 to_precision = 0;
146
16
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
16
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
16
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
16
                    to_precision = to_max_digits;
162
16
                }
163
164
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
16
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
16
                return narrow_integral || multiply_may_overflow;
173
16
            }
174
0
            return false;
175
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
122
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
18
            using Types2 = std::decay_t<decltype(types2)>;
124
18
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
18
                using FromFieldType = typename FromDataType::FieldType;
132
18
                using ToFieldType = typename ToDataType::FieldType;
133
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
18
                UInt32 from_scale = 0;
135
136
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
18
                    const auto* from_decimal_type =
138
18
                            check_and_get_data_type<FromDataType>(from_type.get());
139
18
                    from_precision =
140
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
18
                    from_scale = from_decimal_type->get_scale();
142
18
                }
143
144
18
                UInt32 to_max_digits = 0;
145
18
                UInt32 to_precision = 0;
146
18
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
18
                    to_precision = to_max_digits;
162
18
                }
163
164
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
18
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
18
                return narrow_integral || multiply_may_overflow;
173
18
            }
174
0
            return false;
175
18
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
122
37
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
37
            using Types2 = std::decay_t<decltype(types2)>;
124
37
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
37
            return false;
175
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
122
7.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7.78k
            using Types2 = std::decay_t<decltype(types2)>;
124
7.78k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7.78k
            return false;
175
7.78k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
122
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
162
            using Types2 = std::decay_t<decltype(types2)>;
124
162
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
162
            return false;
175
162
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
122
80
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
80
            using Types2 = std::decay_t<decltype(types2)>;
124
80
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
80
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
80
                return false;
129
80
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
80
            return false;
175
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
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
7
                using FromFieldType = typename FromDataType::FieldType;
132
7
                using ToFieldType = typename ToDataType::FieldType;
133
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
7
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
7
                UInt32 to_max_digits = 0;
145
7
                UInt32 to_precision = 0;
146
7
                UInt32 to_scale = 0;
147
148
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
7
                    const auto* to_decimal_type =
152
7
                            check_and_get_data_type<ToDataType>(to_type.get());
153
7
                    to_precision = to_decimal_type->get_precision();
154
7
                    ToDataType::check_type_precision(to_precision);
155
156
7
                    to_scale = to_decimal_type->get_scale();
157
7
                    ToDataType::check_type_scale(to_scale);
158
7
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
7
                if (to_scale > from_scale) {
169
6
                    multiply_may_overflow &=
170
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
6
                }
172
7
                return narrow_integral || multiply_may_overflow;
173
7
            }
174
0
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
34
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
34
            using Types2 = std::decay_t<decltype(types2)>;
124
34
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
34
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
34
                using FromFieldType = typename FromDataType::FieldType;
132
34
                using ToFieldType = typename ToDataType::FieldType;
133
34
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
34
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
34
                UInt32 to_max_digits = 0;
145
34
                UInt32 to_precision = 0;
146
34
                UInt32 to_scale = 0;
147
148
34
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
34
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
34
                    const auto* to_decimal_type =
152
34
                            check_and_get_data_type<ToDataType>(to_type.get());
153
34
                    to_precision = to_decimal_type->get_precision();
154
34
                    ToDataType::check_type_precision(to_precision);
155
156
34
                    to_scale = to_decimal_type->get_scale();
157
34
                    ToDataType::check_type_scale(to_scale);
158
34
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
34
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
34
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
34
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
34
                if (to_scale > from_scale) {
169
23
                    multiply_may_overflow &=
170
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
23
                }
172
34
                return narrow_integral || multiply_may_overflow;
173
34
            }
174
0
            return false;
175
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
122
39
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
39
            using Types2 = std::decay_t<decltype(types2)>;
124
39
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
39
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
39
                using FromFieldType = typename FromDataType::FieldType;
132
39
                using ToFieldType = typename ToDataType::FieldType;
133
39
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
39
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
39
                UInt32 to_max_digits = 0;
145
39
                UInt32 to_precision = 0;
146
39
                UInt32 to_scale = 0;
147
148
39
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
39
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
39
                    const auto* to_decimal_type =
152
39
                            check_and_get_data_type<ToDataType>(to_type.get());
153
39
                    to_precision = to_decimal_type->get_precision();
154
39
                    ToDataType::check_type_precision(to_precision);
155
156
39
                    to_scale = to_decimal_type->get_scale();
157
39
                    ToDataType::check_type_scale(to_scale);
158
39
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
39
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
39
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
39
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
39
                if (to_scale > from_scale) {
169
23
                    multiply_may_overflow &=
170
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
23
                }
172
39
                return narrow_integral || multiply_may_overflow;
173
39
            }
174
0
            return false;
175
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
122
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
49
            using Types2 = std::decay_t<decltype(types2)>;
124
49
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
49
                using FromFieldType = typename FromDataType::FieldType;
132
49
                using ToFieldType = typename ToDataType::FieldType;
133
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
49
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
49
                UInt32 to_max_digits = 0;
145
49
                UInt32 to_precision = 0;
146
49
                UInt32 to_scale = 0;
147
148
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
49
                    const auto* to_decimal_type =
152
49
                            check_and_get_data_type<ToDataType>(to_type.get());
153
49
                    to_precision = to_decimal_type->get_precision();
154
49
                    ToDataType::check_type_precision(to_precision);
155
156
49
                    to_scale = to_decimal_type->get_scale();
157
49
                    ToDataType::check_type_scale(to_scale);
158
49
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
49
                if (to_scale > from_scale) {
169
28
                    multiply_may_overflow &=
170
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
28
                }
172
49
                return narrow_integral || multiply_may_overflow;
173
49
            }
174
0
            return false;
175
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
122
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
49
            using Types2 = std::decay_t<decltype(types2)>;
124
49
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
49
                using FromFieldType = typename FromDataType::FieldType;
132
49
                using ToFieldType = typename ToDataType::FieldType;
133
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
49
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
49
                UInt32 to_max_digits = 0;
145
49
                UInt32 to_precision = 0;
146
49
                UInt32 to_scale = 0;
147
148
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
49
                    const auto* to_decimal_type =
152
49
                            check_and_get_data_type<ToDataType>(to_type.get());
153
49
                    to_precision = to_decimal_type->get_precision();
154
49
                    ToDataType::check_type_precision(to_precision);
155
156
49
                    to_scale = to_decimal_type->get_scale();
157
49
                    ToDataType::check_type_scale(to_scale);
158
49
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
49
                if (to_scale > from_scale) {
169
28
                    multiply_may_overflow &=
170
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
28
                }
172
49
                return narrow_integral || multiply_may_overflow;
173
49
            }
174
0
            return false;
175
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
122
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
49
            using Types2 = std::decay_t<decltype(types2)>;
124
49
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
49
                using FromFieldType = typename FromDataType::FieldType;
132
49
                using ToFieldType = typename ToDataType::FieldType;
133
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
49
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
49
                UInt32 to_max_digits = 0;
145
49
                UInt32 to_precision = 0;
146
49
                UInt32 to_scale = 0;
147
148
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
49
                    const auto* to_decimal_type =
152
49
                            check_and_get_data_type<ToDataType>(to_type.get());
153
49
                    to_precision = to_decimal_type->get_precision();
154
49
                    ToDataType::check_type_precision(to_precision);
155
156
49
                    to_scale = to_decimal_type->get_scale();
157
49
                    ToDataType::check_type_scale(to_scale);
158
49
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
49
                if (to_scale > from_scale) {
169
28
                    multiply_may_overflow &=
170
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
28
                }
172
49
                return narrow_integral || multiply_may_overflow;
173
49
            }
174
0
            return false;
175
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
122
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
99
            using Types2 = std::decay_t<decltype(types2)>;
124
99
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
99
                using FromFieldType = typename FromDataType::FieldType;
132
99
                using ToFieldType = typename ToDataType::FieldType;
133
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
99
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
99
                UInt32 to_max_digits = 0;
145
99
                UInt32 to_precision = 0;
146
99
                UInt32 to_scale = 0;
147
148
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
99
                    const auto* to_decimal_type =
152
99
                            check_and_get_data_type<ToDataType>(to_type.get());
153
99
                    to_precision = to_decimal_type->get_precision();
154
99
                    ToDataType::check_type_precision(to_precision);
155
156
99
                    to_scale = to_decimal_type->get_scale();
157
99
                    ToDataType::check_type_scale(to_scale);
158
99
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
99
                if (to_scale > from_scale) {
169
66
                    multiply_may_overflow &=
170
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
66
                }
172
99
                return narrow_integral || multiply_may_overflow;
173
99
            }
174
0
            return false;
175
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
122
103
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
103
            using Types2 = std::decay_t<decltype(types2)>;
124
103
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
103
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
103
                using FromFieldType = typename FromDataType::FieldType;
132
103
                using ToFieldType = typename ToDataType::FieldType;
133
103
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
103
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
103
                UInt32 to_max_digits = 0;
145
103
                UInt32 to_precision = 0;
146
103
                UInt32 to_scale = 0;
147
148
103
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
103
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
103
                    const auto* to_decimal_type =
152
103
                            check_and_get_data_type<ToDataType>(to_type.get());
153
103
                    to_precision = to_decimal_type->get_precision();
154
103
                    ToDataType::check_type_precision(to_precision);
155
156
103
                    to_scale = to_decimal_type->get_scale();
157
103
                    ToDataType::check_type_scale(to_scale);
158
103
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
103
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
103
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
103
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
103
                if (to_scale > from_scale) {
169
66
                    multiply_may_overflow &=
170
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
66
                }
172
103
                return narrow_integral || multiply_may_overflow;
173
103
            }
174
0
            return false;
175
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
122
128
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
128
            using Types2 = std::decay_t<decltype(types2)>;
124
128
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
128
                using FromFieldType = typename FromDataType::FieldType;
132
128
                using ToFieldType = typename ToDataType::FieldType;
133
128
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
128
                UInt32 from_scale = 0;
135
136
128
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
128
                    const auto* from_decimal_type =
138
128
                            check_and_get_data_type<FromDataType>(from_type.get());
139
128
                    from_precision =
140
128
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
128
                    from_scale = from_decimal_type->get_scale();
142
128
                }
143
144
128
                UInt32 to_max_digits = 0;
145
128
                UInt32 to_precision = 0;
146
128
                UInt32 to_scale = 0;
147
148
128
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
128
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
128
                    const auto* to_decimal_type =
152
128
                            check_and_get_data_type<ToDataType>(to_type.get());
153
128
                    to_precision = to_decimal_type->get_precision();
154
128
                    ToDataType::check_type_precision(to_precision);
155
156
128
                    to_scale = to_decimal_type->get_scale();
157
128
                    ToDataType::check_type_scale(to_scale);
158
128
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
128
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
128
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
128
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
128
                if (to_scale > from_scale) {
169
62
                    multiply_may_overflow &=
170
62
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
62
                }
172
128
                return narrow_integral || multiply_may_overflow;
173
128
            }
174
0
            return false;
175
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
122
285
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
285
            using Types2 = std::decay_t<decltype(types2)>;
124
285
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
285
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
285
                using FromFieldType = typename FromDataType::FieldType;
132
285
                using ToFieldType = typename ToDataType::FieldType;
133
285
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
285
                UInt32 from_scale = 0;
135
136
285
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
285
                    const auto* from_decimal_type =
138
285
                            check_and_get_data_type<FromDataType>(from_type.get());
139
285
                    from_precision =
140
285
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
285
                    from_scale = from_decimal_type->get_scale();
142
285
                }
143
144
285
                UInt32 to_max_digits = 0;
145
285
                UInt32 to_precision = 0;
146
285
                UInt32 to_scale = 0;
147
148
285
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
285
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
285
                    const auto* to_decimal_type =
152
285
                            check_and_get_data_type<ToDataType>(to_type.get());
153
285
                    to_precision = to_decimal_type->get_precision();
154
285
                    ToDataType::check_type_precision(to_precision);
155
156
285
                    to_scale = to_decimal_type->get_scale();
157
285
                    ToDataType::check_type_scale(to_scale);
158
285
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
285
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
285
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
285
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
285
                if (to_scale > from_scale) {
169
78
                    multiply_may_overflow &=
170
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
78
                }
172
285
                return narrow_integral || multiply_may_overflow;
173
285
            }
174
0
            return false;
175
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
122
161
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
161
            using Types2 = std::decay_t<decltype(types2)>;
124
161
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
161
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
161
                using FromFieldType = typename FromDataType::FieldType;
132
161
                using ToFieldType = typename ToDataType::FieldType;
133
161
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
161
                UInt32 from_scale = 0;
135
136
161
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
161
                    const auto* from_decimal_type =
138
161
                            check_and_get_data_type<FromDataType>(from_type.get());
139
161
                    from_precision =
140
161
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
161
                    from_scale = from_decimal_type->get_scale();
142
161
                }
143
144
161
                UInt32 to_max_digits = 0;
145
161
                UInt32 to_precision = 0;
146
161
                UInt32 to_scale = 0;
147
148
161
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
161
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
161
                    const auto* to_decimal_type =
152
161
                            check_and_get_data_type<ToDataType>(to_type.get());
153
161
                    to_precision = to_decimal_type->get_precision();
154
161
                    ToDataType::check_type_precision(to_precision);
155
156
161
                    to_scale = to_decimal_type->get_scale();
157
161
                    ToDataType::check_type_scale(to_scale);
158
161
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
161
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
161
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
161
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
161
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
161
                return narrow_integral || multiply_may_overflow;
173
161
            }
174
0
            return false;
175
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
122
296
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
296
            using Types2 = std::decay_t<decltype(types2)>;
124
296
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
296
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
296
                using FromFieldType = typename FromDataType::FieldType;
132
296
                using ToFieldType = typename ToDataType::FieldType;
133
296
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
296
                UInt32 from_scale = 0;
135
136
296
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
296
                    const auto* from_decimal_type =
138
296
                            check_and_get_data_type<FromDataType>(from_type.get());
139
296
                    from_precision =
140
296
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
296
                    from_scale = from_decimal_type->get_scale();
142
296
                }
143
144
296
                UInt32 to_max_digits = 0;
145
296
                UInt32 to_precision = 0;
146
296
                UInt32 to_scale = 0;
147
148
296
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
296
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
296
                    const auto* to_decimal_type =
152
296
                            check_and_get_data_type<ToDataType>(to_type.get());
153
296
                    to_precision = to_decimal_type->get_precision();
154
296
                    ToDataType::check_type_precision(to_precision);
155
156
296
                    to_scale = to_decimal_type->get_scale();
157
296
                    ToDataType::check_type_scale(to_scale);
158
296
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
296
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
296
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
296
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
296
                if (to_scale > from_scale) {
169
78
                    multiply_may_overflow &=
170
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
78
                }
172
296
                return narrow_integral || multiply_may_overflow;
173
296
            }
174
0
            return false;
175
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
122
296
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
296
            using Types2 = std::decay_t<decltype(types2)>;
124
296
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
296
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
296
                using FromFieldType = typename FromDataType::FieldType;
132
296
                using ToFieldType = typename ToDataType::FieldType;
133
296
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
296
                UInt32 from_scale = 0;
135
136
296
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
296
                    const auto* from_decimal_type =
138
296
                            check_and_get_data_type<FromDataType>(from_type.get());
139
296
                    from_precision =
140
296
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
296
                    from_scale = from_decimal_type->get_scale();
142
296
                }
143
144
296
                UInt32 to_max_digits = 0;
145
296
                UInt32 to_precision = 0;
146
296
                UInt32 to_scale = 0;
147
148
296
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
296
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
296
                    const auto* to_decimal_type =
152
296
                            check_and_get_data_type<ToDataType>(to_type.get());
153
296
                    to_precision = to_decimal_type->get_precision();
154
296
                    ToDataType::check_type_precision(to_precision);
155
156
296
                    to_scale = to_decimal_type->get_scale();
157
296
                    ToDataType::check_type_scale(to_scale);
158
296
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
296
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
296
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
296
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
296
                if (to_scale > from_scale) {
169
78
                    multiply_may_overflow &=
170
78
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
78
                }
172
296
                return narrow_integral || multiply_may_overflow;
173
296
            }
174
0
            return false;
175
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
122
1.63k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.63k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.63k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1.63k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1.63k
                return false;
129
1.63k
            }
130
1.63k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1.63k
                using FromFieldType = typename FromDataType::FieldType;
132
1.63k
                using ToFieldType = typename ToDataType::FieldType;
133
1.63k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1.63k
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
1.63k
                UInt32 to_max_digits = 0;
145
1.63k
                UInt32 to_precision = 0;
146
1.63k
                UInt32 to_scale = 0;
147
148
1.63k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1.63k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1.63k
                    const auto* to_decimal_type =
152
1.63k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1.63k
                    to_precision = to_decimal_type->get_precision();
154
1.63k
                    ToDataType::check_type_precision(to_precision);
155
156
1.63k
                    to_scale = to_decimal_type->get_scale();
157
1.63k
                    ToDataType::check_type_scale(to_scale);
158
1.63k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
1.63k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1.63k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1.63k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1.63k
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
1.63k
                return narrow_integral || multiply_may_overflow;
173
1.63k
            }
174
0
            return false;
175
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
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
7
                using FromFieldType = typename FromDataType::FieldType;
132
7
                using ToFieldType = typename ToDataType::FieldType;
133
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
7
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
7
                UInt32 to_max_digits = 0;
145
7
                UInt32 to_precision = 0;
146
7
                UInt32 to_scale = 0;
147
148
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
7
                    const auto* to_decimal_type =
152
7
                            check_and_get_data_type<ToDataType>(to_type.get());
153
7
                    to_precision = to_decimal_type->get_precision();
154
7
                    ToDataType::check_type_precision(to_precision);
155
156
7
                    to_scale = to_decimal_type->get_scale();
157
7
                    ToDataType::check_type_scale(to_scale);
158
7
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
7
                if (to_scale > from_scale) {
169
6
                    multiply_may_overflow &=
170
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
6
                }
172
7
                return narrow_integral || multiply_may_overflow;
173
7
            }
174
0
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
29
            using Types2 = std::decay_t<decltype(types2)>;
124
29
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
29
                using FromFieldType = typename FromDataType::FieldType;
132
29
                using ToFieldType = typename ToDataType::FieldType;
133
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
29
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
29
                UInt32 to_max_digits = 0;
145
29
                UInt32 to_precision = 0;
146
29
                UInt32 to_scale = 0;
147
148
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
29
                    const auto* to_decimal_type =
152
29
                            check_and_get_data_type<ToDataType>(to_type.get());
153
29
                    to_precision = to_decimal_type->get_precision();
154
29
                    ToDataType::check_type_precision(to_precision);
155
156
29
                    to_scale = to_decimal_type->get_scale();
157
29
                    ToDataType::check_type_scale(to_scale);
158
29
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
29
                if (to_scale > from_scale) {
169
18
                    multiply_may_overflow &=
170
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
18
                }
172
29
                return narrow_integral || multiply_may_overflow;
173
29
            }
174
0
            return false;
175
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
122
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
29
            using Types2 = std::decay_t<decltype(types2)>;
124
29
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
29
                using FromFieldType = typename FromDataType::FieldType;
132
29
                using ToFieldType = typename ToDataType::FieldType;
133
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
29
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
29
                UInt32 to_max_digits = 0;
145
29
                UInt32 to_precision = 0;
146
29
                UInt32 to_scale = 0;
147
148
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
29
                    const auto* to_decimal_type =
152
29
                            check_and_get_data_type<ToDataType>(to_type.get());
153
29
                    to_precision = to_decimal_type->get_precision();
154
29
                    ToDataType::check_type_precision(to_precision);
155
156
29
                    to_scale = to_decimal_type->get_scale();
157
29
                    ToDataType::check_type_scale(to_scale);
158
29
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
29
                if (to_scale > from_scale) {
169
18
                    multiply_may_overflow &=
170
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
18
                }
172
29
                return narrow_integral || multiply_may_overflow;
173
29
            }
174
0
            return false;
175
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
122
44
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
44
            using Types2 = std::decay_t<decltype(types2)>;
124
44
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
44
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
44
                using FromFieldType = typename FromDataType::FieldType;
132
44
                using ToFieldType = typename ToDataType::FieldType;
133
44
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
44
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
44
                UInt32 to_max_digits = 0;
145
44
                UInt32 to_precision = 0;
146
44
                UInt32 to_scale = 0;
147
148
44
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
44
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
44
                    const auto* to_decimal_type =
152
44
                            check_and_get_data_type<ToDataType>(to_type.get());
153
44
                    to_precision = to_decimal_type->get_precision();
154
44
                    ToDataType::check_type_precision(to_precision);
155
156
44
                    to_scale = to_decimal_type->get_scale();
157
44
                    ToDataType::check_type_scale(to_scale);
158
44
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
44
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
44
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
44
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
44
                if (to_scale > from_scale) {
169
28
                    multiply_may_overflow &=
170
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
28
                }
172
44
                return narrow_integral || multiply_may_overflow;
173
44
            }
174
0
            return false;
175
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
122
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
49
            using Types2 = std::decay_t<decltype(types2)>;
124
49
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
49
                using FromFieldType = typename FromDataType::FieldType;
132
49
                using ToFieldType = typename ToDataType::FieldType;
133
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
49
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
49
                UInt32 to_max_digits = 0;
145
49
                UInt32 to_precision = 0;
146
49
                UInt32 to_scale = 0;
147
148
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
49
                    const auto* to_decimal_type =
152
49
                            check_and_get_data_type<ToDataType>(to_type.get());
153
49
                    to_precision = to_decimal_type->get_precision();
154
49
                    ToDataType::check_type_precision(to_precision);
155
156
49
                    to_scale = to_decimal_type->get_scale();
157
49
                    ToDataType::check_type_scale(to_scale);
158
49
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
49
                if (to_scale > from_scale) {
169
28
                    multiply_may_overflow &=
170
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
28
                }
172
49
                return narrow_integral || multiply_may_overflow;
173
49
            }
174
0
            return false;
175
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
122
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
49
            using Types2 = std::decay_t<decltype(types2)>;
124
49
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
49
                using FromFieldType = typename FromDataType::FieldType;
132
49
                using ToFieldType = typename ToDataType::FieldType;
133
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
49
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
49
                UInt32 to_max_digits = 0;
145
49
                UInt32 to_precision = 0;
146
49
                UInt32 to_scale = 0;
147
148
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
49
                    const auto* to_decimal_type =
152
49
                            check_and_get_data_type<ToDataType>(to_type.get());
153
49
                    to_precision = to_decimal_type->get_precision();
154
49
                    ToDataType::check_type_precision(to_precision);
155
156
49
                    to_scale = to_decimal_type->get_scale();
157
49
                    ToDataType::check_type_scale(to_scale);
158
49
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
49
                if (to_scale > from_scale) {
169
28
                    multiply_may_overflow &=
170
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
28
                }
172
49
                return narrow_integral || multiply_may_overflow;
173
49
            }
174
0
            return false;
175
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
122
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
99
            using Types2 = std::decay_t<decltype(types2)>;
124
99
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
99
                using FromFieldType = typename FromDataType::FieldType;
132
99
                using ToFieldType = typename ToDataType::FieldType;
133
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
99
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
99
                UInt32 to_max_digits = 0;
145
99
                UInt32 to_precision = 0;
146
99
                UInt32 to_scale = 0;
147
148
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
99
                    const auto* to_decimal_type =
152
99
                            check_and_get_data_type<ToDataType>(to_type.get());
153
99
                    to_precision = to_decimal_type->get_precision();
154
99
                    ToDataType::check_type_precision(to_precision);
155
156
99
                    to_scale = to_decimal_type->get_scale();
157
99
                    ToDataType::check_type_scale(to_scale);
158
99
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
99
                if (to_scale > from_scale) {
169
58
                    multiply_may_overflow &=
170
58
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
58
                }
172
99
                return narrow_integral || multiply_may_overflow;
173
99
            }
174
0
            return false;
175
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
122
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
99
            using Types2 = std::decay_t<decltype(types2)>;
124
99
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
99
                using FromFieldType = typename FromDataType::FieldType;
132
99
                using ToFieldType = typename ToDataType::FieldType;
133
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
99
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
99
                UInt32 to_max_digits = 0;
145
99
                UInt32 to_precision = 0;
146
99
                UInt32 to_scale = 0;
147
148
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
99
                    const auto* to_decimal_type =
152
99
                            check_and_get_data_type<ToDataType>(to_type.get());
153
99
                    to_precision = to_decimal_type->get_precision();
154
99
                    ToDataType::check_type_precision(to_precision);
155
156
99
                    to_scale = to_decimal_type->get_scale();
157
99
                    ToDataType::check_type_scale(to_scale);
158
99
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
99
                if (to_scale > from_scale) {
169
66
                    multiply_may_overflow &=
170
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
66
                }
172
99
                return narrow_integral || multiply_may_overflow;
173
99
            }
174
0
            return false;
175
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
122
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
168
            using Types2 = std::decay_t<decltype(types2)>;
124
168
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
168
                using FromFieldType = typename FromDataType::FieldType;
132
168
                using ToFieldType = typename ToDataType::FieldType;
133
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
168
                UInt32 from_scale = 0;
135
136
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
168
                    const auto* from_decimal_type =
138
168
                            check_and_get_data_type<FromDataType>(from_type.get());
139
168
                    from_precision =
140
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
168
                    from_scale = from_decimal_type->get_scale();
142
168
                }
143
144
168
                UInt32 to_max_digits = 0;
145
168
                UInt32 to_precision = 0;
146
168
                UInt32 to_scale = 0;
147
148
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
168
                    const auto* to_decimal_type =
152
168
                            check_and_get_data_type<ToDataType>(to_type.get());
153
168
                    to_precision = to_decimal_type->get_precision();
154
168
                    ToDataType::check_type_precision(to_precision);
155
156
168
                    to_scale = to_decimal_type->get_scale();
157
168
                    ToDataType::check_type_scale(to_scale);
158
168
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
168
                if (to_scale > from_scale) {
169
105
                    multiply_may_overflow &=
170
105
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
105
                }
172
168
                return narrow_integral || multiply_may_overflow;
173
168
            }
174
0
            return false;
175
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
122
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
272
            using Types2 = std::decay_t<decltype(types2)>;
124
272
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
272
                using FromFieldType = typename FromDataType::FieldType;
132
272
                using ToFieldType = typename ToDataType::FieldType;
133
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
272
                UInt32 from_scale = 0;
135
136
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
272
                    const auto* from_decimal_type =
138
272
                            check_and_get_data_type<FromDataType>(from_type.get());
139
272
                    from_precision =
140
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
272
                    from_scale = from_decimal_type->get_scale();
142
272
                }
143
144
272
                UInt32 to_max_digits = 0;
145
272
                UInt32 to_precision = 0;
146
272
                UInt32 to_scale = 0;
147
148
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
272
                    const auto* to_decimal_type =
152
272
                            check_and_get_data_type<ToDataType>(to_type.get());
153
272
                    to_precision = to_decimal_type->get_precision();
154
272
                    ToDataType::check_type_precision(to_precision);
155
156
272
                    to_scale = to_decimal_type->get_scale();
157
272
                    ToDataType::check_type_scale(to_scale);
158
272
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
272
                if (to_scale > from_scale) {
169
152
                    multiply_may_overflow &=
170
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
152
                }
172
272
                return narrow_integral || multiply_may_overflow;
173
272
            }
174
0
            return false;
175
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
122
180
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
180
            using Types2 = std::decay_t<decltype(types2)>;
124
180
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
180
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
180
                using FromFieldType = typename FromDataType::FieldType;
132
180
                using ToFieldType = typename ToDataType::FieldType;
133
180
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
180
                UInt32 from_scale = 0;
135
136
180
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
180
                    const auto* from_decimal_type =
138
180
                            check_and_get_data_type<FromDataType>(from_type.get());
139
180
                    from_precision =
140
180
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
180
                    from_scale = from_decimal_type->get_scale();
142
180
                }
143
144
180
                UInt32 to_max_digits = 0;
145
180
                UInt32 to_precision = 0;
146
180
                UInt32 to_scale = 0;
147
148
180
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
180
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
180
                    const auto* to_decimal_type =
152
180
                            check_and_get_data_type<ToDataType>(to_type.get());
153
180
                    to_precision = to_decimal_type->get_precision();
154
180
                    ToDataType::check_type_precision(to_precision);
155
156
180
                    to_scale = to_decimal_type->get_scale();
157
180
                    ToDataType::check_type_scale(to_scale);
158
180
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
180
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
180
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
180
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
180
                if (to_scale > from_scale) {
169
50
                    multiply_may_overflow &=
170
50
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
50
                }
172
180
                return narrow_integral || multiply_may_overflow;
173
180
            }
174
0
            return false;
175
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
122
381
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
381
            using Types2 = std::decay_t<decltype(types2)>;
124
381
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
381
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
381
                using FromFieldType = typename FromDataType::FieldType;
132
381
                using ToFieldType = typename ToDataType::FieldType;
133
381
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
381
                UInt32 from_scale = 0;
135
136
381
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
381
                    const auto* from_decimal_type =
138
381
                            check_and_get_data_type<FromDataType>(from_type.get());
139
381
                    from_precision =
140
381
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
381
                    from_scale = from_decimal_type->get_scale();
142
381
                }
143
144
381
                UInt32 to_max_digits = 0;
145
381
                UInt32 to_precision = 0;
146
381
                UInt32 to_scale = 0;
147
148
381
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
381
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
381
                    const auto* to_decimal_type =
152
381
                            check_and_get_data_type<ToDataType>(to_type.get());
153
381
                    to_precision = to_decimal_type->get_precision();
154
381
                    ToDataType::check_type_precision(to_precision);
155
156
381
                    to_scale = to_decimal_type->get_scale();
157
381
                    ToDataType::check_type_scale(to_scale);
158
381
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
381
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
381
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
381
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
381
                if (to_scale > from_scale) {
169
136
                    multiply_may_overflow &=
170
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
136
                }
172
381
                return narrow_integral || multiply_may_overflow;
173
381
            }
174
0
            return false;
175
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
122
392
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
392
            using Types2 = std::decay_t<decltype(types2)>;
124
392
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
392
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
392
                using FromFieldType = typename FromDataType::FieldType;
132
392
                using ToFieldType = typename ToDataType::FieldType;
133
392
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
392
                UInt32 from_scale = 0;
135
136
392
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
392
                    const auto* from_decimal_type =
138
392
                            check_and_get_data_type<FromDataType>(from_type.get());
139
392
                    from_precision =
140
392
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
392
                    from_scale = from_decimal_type->get_scale();
142
392
                }
143
144
392
                UInt32 to_max_digits = 0;
145
392
                UInt32 to_precision = 0;
146
392
                UInt32 to_scale = 0;
147
148
392
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
392
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
392
                    const auto* to_decimal_type =
152
392
                            check_and_get_data_type<ToDataType>(to_type.get());
153
392
                    to_precision = to_decimal_type->get_precision();
154
392
                    ToDataType::check_type_precision(to_precision);
155
156
392
                    to_scale = to_decimal_type->get_scale();
157
392
                    ToDataType::check_type_scale(to_scale);
158
392
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
392
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
392
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
392
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
392
                if (to_scale > from_scale) {
169
136
                    multiply_may_overflow &=
170
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
136
                }
172
392
                return narrow_integral || multiply_may_overflow;
173
392
            }
174
0
            return false;
175
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
122
1.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.41k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.41k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1.41k
                return false;
129
1.41k
            }
130
1.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1.41k
                using FromFieldType = typename FromDataType::FieldType;
132
1.41k
                using ToFieldType = typename ToDataType::FieldType;
133
1.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1.41k
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
1.41k
                UInt32 to_max_digits = 0;
145
1.41k
                UInt32 to_precision = 0;
146
1.41k
                UInt32 to_scale = 0;
147
148
1.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1.41k
                    const auto* to_decimal_type =
152
1.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1.41k
                    to_precision = to_decimal_type->get_precision();
154
1.41k
                    ToDataType::check_type_precision(to_precision);
155
156
1.41k
                    to_scale = to_decimal_type->get_scale();
157
1.41k
                    ToDataType::check_type_scale(to_scale);
158
1.41k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
1.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1.41k
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
1.41k
                return narrow_integral || multiply_may_overflow;
173
1.41k
            }
174
0
            return false;
175
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
122
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
4
            using Types2 = std::decay_t<decltype(types2)>;
124
4
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
4
                using FromFieldType = typename FromDataType::FieldType;
132
4
                using ToFieldType = typename ToDataType::FieldType;
133
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
4
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
4
                UInt32 to_max_digits = 0;
145
4
                UInt32 to_precision = 0;
146
4
                UInt32 to_scale = 0;
147
148
4
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
4
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
4
                    const auto* to_decimal_type =
152
4
                            check_and_get_data_type<ToDataType>(to_type.get());
153
4
                    to_precision = to_decimal_type->get_precision();
154
4
                    ToDataType::check_type_precision(to_precision);
155
156
4
                    to_scale = to_decimal_type->get_scale();
157
4
                    ToDataType::check_type_scale(to_scale);
158
4
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
4
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
4
                if (to_scale > from_scale) {
169
4
                    multiply_may_overflow &=
170
4
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
4
                }
172
4
                return narrow_integral || multiply_may_overflow;
173
4
            }
174
0
            return false;
175
4
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_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
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
7
                using FromFieldType = typename FromDataType::FieldType;
132
7
                using ToFieldType = typename ToDataType::FieldType;
133
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
7
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
7
                UInt32 to_max_digits = 0;
145
7
                UInt32 to_precision = 0;
146
7
                UInt32 to_scale = 0;
147
148
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
7
                    const auto* to_decimal_type =
152
7
                            check_and_get_data_type<ToDataType>(to_type.get());
153
7
                    to_precision = to_decimal_type->get_precision();
154
7
                    ToDataType::check_type_precision(to_precision);
155
156
7
                    to_scale = to_decimal_type->get_scale();
157
7
                    ToDataType::check_type_scale(to_scale);
158
7
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
7
                if (to_scale > from_scale) {
169
6
                    multiply_may_overflow &=
170
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
6
                }
172
7
                return narrow_integral || multiply_may_overflow;
173
7
            }
174
0
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
29
            using Types2 = std::decay_t<decltype(types2)>;
124
29
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
29
                using FromFieldType = typename FromDataType::FieldType;
132
29
                using ToFieldType = typename ToDataType::FieldType;
133
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
29
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
29
                UInt32 to_max_digits = 0;
145
29
                UInt32 to_precision = 0;
146
29
                UInt32 to_scale = 0;
147
148
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
29
                    const auto* to_decimal_type =
152
29
                            check_and_get_data_type<ToDataType>(to_type.get());
153
29
                    to_precision = to_decimal_type->get_precision();
154
29
                    ToDataType::check_type_precision(to_precision);
155
156
29
                    to_scale = to_decimal_type->get_scale();
157
29
                    ToDataType::check_type_scale(to_scale);
158
29
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
29
                if (to_scale > from_scale) {
169
18
                    multiply_may_overflow &=
170
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
18
                }
172
29
                return narrow_integral || multiply_may_overflow;
173
29
            }
174
0
            return false;
175
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
122
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
29
            using Types2 = std::decay_t<decltype(types2)>;
124
29
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
29
                using FromFieldType = typename FromDataType::FieldType;
132
29
                using ToFieldType = typename ToDataType::FieldType;
133
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
29
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
29
                UInt32 to_max_digits = 0;
145
29
                UInt32 to_precision = 0;
146
29
                UInt32 to_scale = 0;
147
148
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
29
                    const auto* to_decimal_type =
152
29
                            check_and_get_data_type<ToDataType>(to_type.get());
153
29
                    to_precision = to_decimal_type->get_precision();
154
29
                    ToDataType::check_type_precision(to_precision);
155
156
29
                    to_scale = to_decimal_type->get_scale();
157
29
                    ToDataType::check_type_scale(to_scale);
158
29
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
29
                if (to_scale > from_scale) {
169
18
                    multiply_may_overflow &=
170
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
18
                }
172
29
                return narrow_integral || multiply_may_overflow;
173
29
            }
174
0
            return false;
175
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
122
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
29
            using Types2 = std::decay_t<decltype(types2)>;
124
29
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
29
                using FromFieldType = typename FromDataType::FieldType;
132
29
                using ToFieldType = typename ToDataType::FieldType;
133
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
29
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
29
                UInt32 to_max_digits = 0;
145
29
                UInt32 to_precision = 0;
146
29
                UInt32 to_scale = 0;
147
148
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
29
                    const auto* to_decimal_type =
152
29
                            check_and_get_data_type<ToDataType>(to_type.get());
153
29
                    to_precision = to_decimal_type->get_precision();
154
29
                    ToDataType::check_type_precision(to_precision);
155
156
29
                    to_scale = to_decimal_type->get_scale();
157
29
                    ToDataType::check_type_scale(to_scale);
158
29
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
29
                if (to_scale > from_scale) {
169
18
                    multiply_may_overflow &=
170
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
18
                }
172
29
                return narrow_integral || multiply_may_overflow;
173
29
            }
174
0
            return false;
175
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
122
34
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
34
            using Types2 = std::decay_t<decltype(types2)>;
124
34
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
34
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
34
                using FromFieldType = typename FromDataType::FieldType;
132
34
                using ToFieldType = typename ToDataType::FieldType;
133
34
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
34
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
34
                UInt32 to_max_digits = 0;
145
34
                UInt32 to_precision = 0;
146
34
                UInt32 to_scale = 0;
147
148
34
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
34
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
34
                    const auto* to_decimal_type =
152
34
                            check_and_get_data_type<ToDataType>(to_type.get());
153
34
                    to_precision = to_decimal_type->get_precision();
154
34
                    ToDataType::check_type_precision(to_precision);
155
156
34
                    to_scale = to_decimal_type->get_scale();
157
34
                    ToDataType::check_type_scale(to_scale);
158
34
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
34
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
34
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
34
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
34
                if (to_scale > from_scale) {
169
23
                    multiply_may_overflow &=
170
23
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
23
                }
172
34
                return narrow_integral || multiply_may_overflow;
173
34
            }
174
0
            return false;
175
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
122
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
49
            using Types2 = std::decay_t<decltype(types2)>;
124
49
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
49
                using FromFieldType = typename FromDataType::FieldType;
132
49
                using ToFieldType = typename ToDataType::FieldType;
133
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
49
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
49
                UInt32 to_max_digits = 0;
145
49
                UInt32 to_precision = 0;
146
49
                UInt32 to_scale = 0;
147
148
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
49
                    const auto* to_decimal_type =
152
49
                            check_and_get_data_type<ToDataType>(to_type.get());
153
49
                    to_precision = to_decimal_type->get_precision();
154
49
                    ToDataType::check_type_precision(to_precision);
155
156
49
                    to_scale = to_decimal_type->get_scale();
157
49
                    ToDataType::check_type_scale(to_scale);
158
49
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
49
                if (to_scale > from_scale) {
169
28
                    multiply_may_overflow &=
170
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
28
                }
172
49
                return narrow_integral || multiply_may_overflow;
173
49
            }
174
0
            return false;
175
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
122
107
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
107
            using Types2 = std::decay_t<decltype(types2)>;
124
107
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
107
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
107
                using FromFieldType = typename FromDataType::FieldType;
132
107
                using ToFieldType = typename ToDataType::FieldType;
133
107
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
107
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
107
                UInt32 to_max_digits = 0;
145
107
                UInt32 to_precision = 0;
146
107
                UInt32 to_scale = 0;
147
148
107
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
107
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
107
                    const auto* to_decimal_type =
152
107
                            check_and_get_data_type<ToDataType>(to_type.get());
153
107
                    to_precision = to_decimal_type->get_precision();
154
107
                    ToDataType::check_type_precision(to_precision);
155
156
107
                    to_scale = to_decimal_type->get_scale();
157
107
                    ToDataType::check_type_scale(to_scale);
158
107
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
107
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
107
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
107
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
107
                if (to_scale > from_scale) {
169
66
                    multiply_may_overflow &=
170
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
66
                }
172
107
                return narrow_integral || multiply_may_overflow;
173
107
            }
174
0
            return false;
175
107
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
122
91
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
91
            using Types2 = std::decay_t<decltype(types2)>;
124
91
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
91
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
91
                using FromFieldType = typename FromDataType::FieldType;
132
91
                using ToFieldType = typename ToDataType::FieldType;
133
91
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
91
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
91
                UInt32 to_max_digits = 0;
145
91
                UInt32 to_precision = 0;
146
91
                UInt32 to_scale = 0;
147
148
91
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
91
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
91
                    const auto* to_decimal_type =
152
91
                            check_and_get_data_type<ToDataType>(to_type.get());
153
91
                    to_precision = to_decimal_type->get_precision();
154
91
                    ToDataType::check_type_precision(to_precision);
155
156
91
                    to_scale = to_decimal_type->get_scale();
157
91
                    ToDataType::check_type_scale(to_scale);
158
91
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
91
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
91
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
91
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
91
                if (to_scale > from_scale) {
169
58
                    multiply_may_overflow &=
170
58
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
58
                }
172
91
                return narrow_integral || multiply_may_overflow;
173
91
            }
174
0
            return false;
175
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
122
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
168
            using Types2 = std::decay_t<decltype(types2)>;
124
168
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
168
                using FromFieldType = typename FromDataType::FieldType;
132
168
                using ToFieldType = typename ToDataType::FieldType;
133
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
168
                UInt32 from_scale = 0;
135
136
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
168
                    const auto* from_decimal_type =
138
168
                            check_and_get_data_type<FromDataType>(from_type.get());
139
168
                    from_precision =
140
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
168
                    from_scale = from_decimal_type->get_scale();
142
168
                }
143
144
168
                UInt32 to_max_digits = 0;
145
168
                UInt32 to_precision = 0;
146
168
                UInt32 to_scale = 0;
147
148
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
168
                    const auto* to_decimal_type =
152
168
                            check_and_get_data_type<ToDataType>(to_type.get());
153
168
                    to_precision = to_decimal_type->get_precision();
154
168
                    ToDataType::check_type_precision(to_precision);
155
156
168
                    to_scale = to_decimal_type->get_scale();
157
168
                    ToDataType::check_type_scale(to_scale);
158
168
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
168
                if (to_scale > from_scale) {
169
106
                    multiply_may_overflow &=
170
106
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
106
                }
172
168
                return narrow_integral || multiply_may_overflow;
173
168
            }
174
0
            return false;
175
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
122
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
264
            using Types2 = std::decay_t<decltype(types2)>;
124
264
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
264
                using FromFieldType = typename FromDataType::FieldType;
132
264
                using ToFieldType = typename ToDataType::FieldType;
133
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
264
                UInt32 from_scale = 0;
135
136
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
264
                    const auto* from_decimal_type =
138
264
                            check_and_get_data_type<FromDataType>(from_type.get());
139
264
                    from_precision =
140
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
264
                    from_scale = from_decimal_type->get_scale();
142
264
                }
143
144
264
                UInt32 to_max_digits = 0;
145
264
                UInt32 to_precision = 0;
146
264
                UInt32 to_scale = 0;
147
148
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
264
                    const auto* to_decimal_type =
152
264
                            check_and_get_data_type<ToDataType>(to_type.get());
153
264
                    to_precision = to_decimal_type->get_precision();
154
264
                    ToDataType::check_type_precision(to_precision);
155
156
264
                    to_scale = to_decimal_type->get_scale();
157
264
                    ToDataType::check_type_scale(to_scale);
158
264
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
264
                if (to_scale > from_scale) {
169
159
                    multiply_may_overflow &=
170
159
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
159
                }
172
264
                return narrow_integral || multiply_may_overflow;
173
264
            }
174
0
            return false;
175
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
122
135
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
135
            using Types2 = std::decay_t<decltype(types2)>;
124
135
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
135
                using FromFieldType = typename FromDataType::FieldType;
132
135
                using ToFieldType = typename ToDataType::FieldType;
133
135
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
135
                UInt32 from_scale = 0;
135
136
135
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
135
                    const auto* from_decimal_type =
138
135
                            check_and_get_data_type<FromDataType>(from_type.get());
139
135
                    from_precision =
140
135
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
135
                    from_scale = from_decimal_type->get_scale();
142
135
                }
143
144
135
                UInt32 to_max_digits = 0;
145
135
                UInt32 to_precision = 0;
146
135
                UInt32 to_scale = 0;
147
148
135
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
135
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
135
                    const auto* to_decimal_type =
152
135
                            check_and_get_data_type<ToDataType>(to_type.get());
153
135
                    to_precision = to_decimal_type->get_precision();
154
135
                    ToDataType::check_type_precision(to_precision);
155
156
135
                    to_scale = to_decimal_type->get_scale();
157
135
                    ToDataType::check_type_scale(to_scale);
158
135
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
135
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
135
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
135
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
135
                if (to_scale > from_scale) {
169
68
                    multiply_may_overflow &=
170
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
68
                }
172
135
                return narrow_integral || multiply_may_overflow;
173
135
            }
174
0
            return false;
175
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
122
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
272
            using Types2 = std::decay_t<decltype(types2)>;
124
272
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
272
                using FromFieldType = typename FromDataType::FieldType;
132
272
                using ToFieldType = typename ToDataType::FieldType;
133
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
272
                UInt32 from_scale = 0;
135
136
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
272
                    const auto* from_decimal_type =
138
272
                            check_and_get_data_type<FromDataType>(from_type.get());
139
272
                    from_precision =
140
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
272
                    from_scale = from_decimal_type->get_scale();
142
272
                }
143
144
272
                UInt32 to_max_digits = 0;
145
272
                UInt32 to_precision = 0;
146
272
                UInt32 to_scale = 0;
147
148
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
272
                    const auto* to_decimal_type =
152
272
                            check_and_get_data_type<ToDataType>(to_type.get());
153
272
                    to_precision = to_decimal_type->get_precision();
154
272
                    ToDataType::check_type_precision(to_precision);
155
156
272
                    to_scale = to_decimal_type->get_scale();
157
272
                    ToDataType::check_type_scale(to_scale);
158
272
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
272
                if (to_scale > from_scale) {
169
152
                    multiply_may_overflow &=
170
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
152
                }
172
272
                return narrow_integral || multiply_may_overflow;
173
272
            }
174
0
            return false;
175
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
122
381
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
381
            using Types2 = std::decay_t<decltype(types2)>;
124
381
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
381
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
381
                using FromFieldType = typename FromDataType::FieldType;
132
381
                using ToFieldType = typename ToDataType::FieldType;
133
381
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
381
                UInt32 from_scale = 0;
135
136
381
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
381
                    const auto* from_decimal_type =
138
381
                            check_and_get_data_type<FromDataType>(from_type.get());
139
381
                    from_precision =
140
381
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
381
                    from_scale = from_decimal_type->get_scale();
142
381
                }
143
144
381
                UInt32 to_max_digits = 0;
145
381
                UInt32 to_precision = 0;
146
381
                UInt32 to_scale = 0;
147
148
381
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
381
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
381
                    const auto* to_decimal_type =
152
381
                            check_and_get_data_type<ToDataType>(to_type.get());
153
381
                    to_precision = to_decimal_type->get_precision();
154
381
                    ToDataType::check_type_precision(to_precision);
155
156
381
                    to_scale = to_decimal_type->get_scale();
157
381
                    ToDataType::check_type_scale(to_scale);
158
381
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
381
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
381
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
381
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
381
                if (to_scale > from_scale) {
169
136
                    multiply_may_overflow &=
170
136
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
136
                }
172
381
                return narrow_integral || multiply_may_overflow;
173
381
            }
174
0
            return false;
175
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
122
1.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.41k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.41k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1.41k
                return false;
129
1.41k
            }
130
1.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1.41k
                using FromFieldType = typename FromDataType::FieldType;
132
1.41k
                using ToFieldType = typename ToDataType::FieldType;
133
1.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1.41k
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
1.41k
                UInt32 to_max_digits = 0;
145
1.41k
                UInt32 to_precision = 0;
146
1.41k
                UInt32 to_scale = 0;
147
148
1.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1.41k
                    const auto* to_decimal_type =
152
1.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1.41k
                    to_precision = to_decimal_type->get_precision();
154
1.41k
                    ToDataType::check_type_precision(to_precision);
155
156
1.41k
                    to_scale = to_decimal_type->get_scale();
157
1.41k
                    ToDataType::check_type_scale(to_scale);
158
1.41k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
1.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1.41k
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
1.41k
                return narrow_integral || multiply_may_overflow;
173
1.41k
            }
174
0
            return false;
175
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
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
7
                using FromFieldType = typename FromDataType::FieldType;
132
7
                using ToFieldType = typename ToDataType::FieldType;
133
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
7
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
7
                UInt32 to_max_digits = 0;
145
7
                UInt32 to_precision = 0;
146
7
                UInt32 to_scale = 0;
147
148
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
7
                    const auto* to_decimal_type =
152
7
                            check_and_get_data_type<ToDataType>(to_type.get());
153
7
                    to_precision = to_decimal_type->get_precision();
154
7
                    ToDataType::check_type_precision(to_precision);
155
156
7
                    to_scale = to_decimal_type->get_scale();
157
7
                    ToDataType::check_type_scale(to_scale);
158
7
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
7
                if (to_scale > from_scale) {
169
6
                    multiply_may_overflow &=
170
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
6
                }
172
7
                return narrow_integral || multiply_may_overflow;
173
7
            }
174
0
            return false;
175
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
122
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
29
            using Types2 = std::decay_t<decltype(types2)>;
124
29
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
29
                using FromFieldType = typename FromDataType::FieldType;
132
29
                using ToFieldType = typename ToDataType::FieldType;
133
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
29
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
29
                UInt32 to_max_digits = 0;
145
29
                UInt32 to_precision = 0;
146
29
                UInt32 to_scale = 0;
147
148
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
29
                    const auto* to_decimal_type =
152
29
                            check_and_get_data_type<ToDataType>(to_type.get());
153
29
                    to_precision = to_decimal_type->get_precision();
154
29
                    ToDataType::check_type_precision(to_precision);
155
156
29
                    to_scale = to_decimal_type->get_scale();
157
29
                    ToDataType::check_type_scale(to_scale);
158
29
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
29
                if (to_scale > from_scale) {
169
18
                    multiply_may_overflow &=
170
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
18
                }
172
29
                return narrow_integral || multiply_may_overflow;
173
29
            }
174
0
            return false;
175
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
122
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
29
            using Types2 = std::decay_t<decltype(types2)>;
124
29
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
29
                using FromFieldType = typename FromDataType::FieldType;
132
29
                using ToFieldType = typename ToDataType::FieldType;
133
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
29
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
29
                UInt32 to_max_digits = 0;
145
29
                UInt32 to_precision = 0;
146
29
                UInt32 to_scale = 0;
147
148
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
29
                    const auto* to_decimal_type =
152
29
                            check_and_get_data_type<ToDataType>(to_type.get());
153
29
                    to_precision = to_decimal_type->get_precision();
154
29
                    ToDataType::check_type_precision(to_precision);
155
156
29
                    to_scale = to_decimal_type->get_scale();
157
29
                    ToDataType::check_type_scale(to_scale);
158
29
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
29
                if (to_scale > from_scale) {
169
18
                    multiply_may_overflow &=
170
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
18
                }
172
29
                return narrow_integral || multiply_may_overflow;
173
29
            }
174
0
            return false;
175
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
122
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
29
            using Types2 = std::decay_t<decltype(types2)>;
124
29
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
29
                using FromFieldType = typename FromDataType::FieldType;
132
29
                using ToFieldType = typename ToDataType::FieldType;
133
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
29
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
29
                UInt32 to_max_digits = 0;
145
29
                UInt32 to_precision = 0;
146
29
                UInt32 to_scale = 0;
147
148
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
29
                    const auto* to_decimal_type =
152
29
                            check_and_get_data_type<ToDataType>(to_type.get());
153
29
                    to_precision = to_decimal_type->get_precision();
154
29
                    ToDataType::check_type_precision(to_precision);
155
156
29
                    to_scale = to_decimal_type->get_scale();
157
29
                    ToDataType::check_type_scale(to_scale);
158
29
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
29
                if (to_scale > from_scale) {
169
18
                    multiply_may_overflow &=
170
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
18
                }
172
29
                return narrow_integral || multiply_may_overflow;
173
29
            }
174
0
            return false;
175
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
122
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
29
            using Types2 = std::decay_t<decltype(types2)>;
124
29
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
29
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
29
                using FromFieldType = typename FromDataType::FieldType;
132
29
                using ToFieldType = typename ToDataType::FieldType;
133
29
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
29
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
29
                UInt32 to_max_digits = 0;
145
29
                UInt32 to_precision = 0;
146
29
                UInt32 to_scale = 0;
147
148
29
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
29
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
29
                    const auto* to_decimal_type =
152
29
                            check_and_get_data_type<ToDataType>(to_type.get());
153
29
                    to_precision = to_decimal_type->get_precision();
154
29
                    ToDataType::check_type_precision(to_precision);
155
156
29
                    to_scale = to_decimal_type->get_scale();
157
29
                    ToDataType::check_type_scale(to_scale);
158
29
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
29
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
29
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
29
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
29
                if (to_scale > from_scale) {
169
18
                    multiply_may_overflow &=
170
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
18
                }
172
29
                return narrow_integral || multiply_may_overflow;
173
29
            }
174
0
            return false;
175
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
122
44
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
44
            using Types2 = std::decay_t<decltype(types2)>;
124
44
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
44
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
44
                using FromFieldType = typename FromDataType::FieldType;
132
44
                using ToFieldType = typename ToDataType::FieldType;
133
44
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
44
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
44
                UInt32 to_max_digits = 0;
145
44
                UInt32 to_precision = 0;
146
44
                UInt32 to_scale = 0;
147
148
44
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
44
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
44
                    const auto* to_decimal_type =
152
44
                            check_and_get_data_type<ToDataType>(to_type.get());
153
44
                    to_precision = to_decimal_type->get_precision();
154
44
                    ToDataType::check_type_precision(to_precision);
155
156
44
                    to_scale = to_decimal_type->get_scale();
157
44
                    ToDataType::check_type_scale(to_scale);
158
44
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
44
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
44
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
44
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
44
                if (to_scale > from_scale) {
169
28
                    multiply_may_overflow &=
170
28
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
28
                }
172
44
                return narrow_integral || multiply_may_overflow;
173
44
            }
174
0
            return false;
175
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
122
87
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
87
            using Types2 = std::decay_t<decltype(types2)>;
124
87
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
87
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
87
                using FromFieldType = typename FromDataType::FieldType;
132
87
                using ToFieldType = typename ToDataType::FieldType;
133
87
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
87
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
87
                UInt32 to_max_digits = 0;
145
87
                UInt32 to_precision = 0;
146
87
                UInt32 to_scale = 0;
147
148
87
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
87
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
87
                    const auto* to_decimal_type =
152
87
                            check_and_get_data_type<ToDataType>(to_type.get());
153
87
                    to_precision = to_decimal_type->get_precision();
154
87
                    ToDataType::check_type_precision(to_precision);
155
156
87
                    to_scale = to_decimal_type->get_scale();
157
87
                    ToDataType::check_type_scale(to_scale);
158
87
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
87
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
87
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
87
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
87
                if (to_scale > from_scale) {
169
66
                    multiply_may_overflow &=
170
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
66
                }
172
87
                return narrow_integral || multiply_may_overflow;
173
87
            }
174
0
            return false;
175
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
122
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
99
            using Types2 = std::decay_t<decltype(types2)>;
124
99
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
99
                using FromFieldType = typename FromDataType::FieldType;
132
99
                using ToFieldType = typename ToDataType::FieldType;
133
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
99
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
99
                UInt32 to_max_digits = 0;
145
99
                UInt32 to_precision = 0;
146
99
                UInt32 to_scale = 0;
147
148
99
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
99
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
99
                    const auto* to_decimal_type =
152
99
                            check_and_get_data_type<ToDataType>(to_type.get());
153
99
                    to_precision = to_decimal_type->get_precision();
154
99
                    ToDataType::check_type_precision(to_precision);
155
156
99
                    to_scale = to_decimal_type->get_scale();
157
99
                    ToDataType::check_type_scale(to_scale);
158
99
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
99
                if (to_scale > from_scale) {
169
66
                    multiply_may_overflow &=
170
66
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
66
                }
172
99
                return narrow_integral || multiply_may_overflow;
173
99
            }
174
0
            return false;
175
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
122
168
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
168
            using Types2 = std::decay_t<decltype(types2)>;
124
168
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
168
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
168
                using FromFieldType = typename FromDataType::FieldType;
132
168
                using ToFieldType = typename ToDataType::FieldType;
133
168
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
168
                UInt32 from_scale = 0;
135
136
168
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
168
                    const auto* from_decimal_type =
138
168
                            check_and_get_data_type<FromDataType>(from_type.get());
139
168
                    from_precision =
140
168
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
168
                    from_scale = from_decimal_type->get_scale();
142
168
                }
143
144
168
                UInt32 to_max_digits = 0;
145
168
                UInt32 to_precision = 0;
146
168
                UInt32 to_scale = 0;
147
148
168
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
168
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
168
                    const auto* to_decimal_type =
152
168
                            check_and_get_data_type<ToDataType>(to_type.get());
153
168
                    to_precision = to_decimal_type->get_precision();
154
168
                    ToDataType::check_type_precision(to_precision);
155
156
168
                    to_scale = to_decimal_type->get_scale();
157
168
                    ToDataType::check_type_scale(to_scale);
158
168
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
168
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
168
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
168
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
168
                if (to_scale > from_scale) {
169
106
                    multiply_may_overflow &=
170
106
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
106
                }
172
168
                return narrow_integral || multiply_may_overflow;
173
168
            }
174
0
            return false;
175
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
122
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
264
            using Types2 = std::decay_t<decltype(types2)>;
124
264
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
264
                using FromFieldType = typename FromDataType::FieldType;
132
264
                using ToFieldType = typename ToDataType::FieldType;
133
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
264
                UInt32 from_scale = 0;
135
136
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
264
                    const auto* from_decimal_type =
138
264
                            check_and_get_data_type<FromDataType>(from_type.get());
139
264
                    from_precision =
140
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
264
                    from_scale = from_decimal_type->get_scale();
142
264
                }
143
144
264
                UInt32 to_max_digits = 0;
145
264
                UInt32 to_precision = 0;
146
264
                UInt32 to_scale = 0;
147
148
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
264
                    const auto* to_decimal_type =
152
264
                            check_and_get_data_type<ToDataType>(to_type.get());
153
264
                    to_precision = to_decimal_type->get_precision();
154
264
                    ToDataType::check_type_precision(to_precision);
155
156
264
                    to_scale = to_decimal_type->get_scale();
157
264
                    ToDataType::check_type_scale(to_scale);
158
264
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
264
                if (to_scale > from_scale) {
169
160
                    multiply_may_overflow &=
170
160
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
160
                }
172
264
                return narrow_integral || multiply_may_overflow;
173
264
            }
174
0
            return false;
175
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
122
132
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
132
            using Types2 = std::decay_t<decltype(types2)>;
124
132
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
132
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
132
                using FromFieldType = typename FromDataType::FieldType;
132
132
                using ToFieldType = typename ToDataType::FieldType;
133
132
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
132
                UInt32 from_scale = 0;
135
136
132
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
132
                    const auto* from_decimal_type =
138
132
                            check_and_get_data_type<FromDataType>(from_type.get());
139
132
                    from_precision =
140
132
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
132
                    from_scale = from_decimal_type->get_scale();
142
132
                }
143
144
132
                UInt32 to_max_digits = 0;
145
132
                UInt32 to_precision = 0;
146
132
                UInt32 to_scale = 0;
147
148
132
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
132
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
132
                    const auto* to_decimal_type =
152
132
                            check_and_get_data_type<ToDataType>(to_type.get());
153
132
                    to_precision = to_decimal_type->get_precision();
154
132
                    ToDataType::check_type_precision(to_precision);
155
156
132
                    to_scale = to_decimal_type->get_scale();
157
132
                    ToDataType::check_type_scale(to_scale);
158
132
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
132
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
132
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
132
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
132
                if (to_scale > from_scale) {
169
68
                    multiply_may_overflow &=
170
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
68
                }
172
132
                return narrow_integral || multiply_may_overflow;
173
132
            }
174
0
            return false;
175
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
122
264
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
264
            using Types2 = std::decay_t<decltype(types2)>;
124
264
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
264
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
264
                using FromFieldType = typename FromDataType::FieldType;
132
264
                using ToFieldType = typename ToDataType::FieldType;
133
264
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
264
                UInt32 from_scale = 0;
135
136
264
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
264
                    const auto* from_decimal_type =
138
264
                            check_and_get_data_type<FromDataType>(from_type.get());
139
264
                    from_precision =
140
264
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
264
                    from_scale = from_decimal_type->get_scale();
142
264
                }
143
144
264
                UInt32 to_max_digits = 0;
145
264
                UInt32 to_precision = 0;
146
264
                UInt32 to_scale = 0;
147
148
264
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
264
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
264
                    const auto* to_decimal_type =
152
264
                            check_and_get_data_type<ToDataType>(to_type.get());
153
264
                    to_precision = to_decimal_type->get_precision();
154
264
                    ToDataType::check_type_precision(to_precision);
155
156
264
                    to_scale = to_decimal_type->get_scale();
157
264
                    ToDataType::check_type_scale(to_scale);
158
264
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
264
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
264
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
264
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
264
                if (to_scale > from_scale) {
169
159
                    multiply_may_overflow &=
170
159
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
159
                }
172
264
                return narrow_integral || multiply_may_overflow;
173
264
            }
174
0
            return false;
175
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
122
272
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
272
            using Types2 = std::decay_t<decltype(types2)>;
124
272
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
272
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
272
                using FromFieldType = typename FromDataType::FieldType;
132
272
                using ToFieldType = typename ToDataType::FieldType;
133
272
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
272
                UInt32 from_scale = 0;
135
136
272
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
272
                    const auto* from_decimal_type =
138
272
                            check_and_get_data_type<FromDataType>(from_type.get());
139
272
                    from_precision =
140
272
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
272
                    from_scale = from_decimal_type->get_scale();
142
272
                }
143
144
272
                UInt32 to_max_digits = 0;
145
272
                UInt32 to_precision = 0;
146
272
                UInt32 to_scale = 0;
147
148
272
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
272
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
272
                    const auto* to_decimal_type =
152
272
                            check_and_get_data_type<ToDataType>(to_type.get());
153
272
                    to_precision = to_decimal_type->get_precision();
154
272
                    ToDataType::check_type_precision(to_precision);
155
156
272
                    to_scale = to_decimal_type->get_scale();
157
272
                    ToDataType::check_type_scale(to_scale);
158
272
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
272
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
272
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
272
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
272
                if (to_scale > from_scale) {
169
152
                    multiply_may_overflow &=
170
152
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
152
                }
172
272
                return narrow_integral || multiply_may_overflow;
173
272
            }
174
0
            return false;
175
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
122
1.39k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.39k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.39k
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1.39k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1.39k
                return false;
129
1.39k
            }
130
1.39k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1.39k
                using FromFieldType = typename FromDataType::FieldType;
132
1.39k
                using ToFieldType = typename ToDataType::FieldType;
133
1.39k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1.39k
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
1.39k
                UInt32 to_max_digits = 0;
145
1.39k
                UInt32 to_precision = 0;
146
1.39k
                UInt32 to_scale = 0;
147
148
1.39k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1.39k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1.39k
                    const auto* to_decimal_type =
152
1.39k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1.39k
                    to_precision = to_decimal_type->get_precision();
154
1.39k
                    ToDataType::check_type_precision(to_precision);
155
156
1.39k
                    to_scale = to_decimal_type->get_scale();
157
1.39k
                    ToDataType::check_type_scale(to_scale);
158
1.39k
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
1.39k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1.39k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1.39k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1.39k
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
1.39k
                return narrow_integral || multiply_may_overflow;
173
1.39k
            }
174
0
            return false;
175
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
122
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1
            using Types2 = std::decay_t<decltype(types2)>;
124
1
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1
                return false;
129
1
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1
            return false;
175
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_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
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Line
Count
Source
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2
                using FromFieldType = typename FromDataType::FieldType;
132
2
                using ToFieldType = typename ToDataType::FieldType;
133
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2
                UInt32 from_scale = 0;
135
136
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
2
                    const auto* from_decimal_type =
138
2
                            check_and_get_data_type<FromDataType>(from_type.get());
139
2
                    from_precision =
140
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
2
                    from_scale = from_decimal_type->get_scale();
142
2
                }
143
144
2
                UInt32 to_max_digits = 0;
145
2
                UInt32 to_precision = 0;
146
2
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
2
                return narrow_integral || multiply_may_overflow;
173
2
            }
174
0
            return false;
175
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
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
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_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
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
122
52
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
52
            using Types2 = std::decay_t<decltype(types2)>;
124
52
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
52
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
52
                return false;
129
52
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
52
            return false;
175
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
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
7
            return false;
175
7
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_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
122
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
4
            using Types2 = std::decay_t<decltype(types2)>;
124
4
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
4
                using FromFieldType = typename FromDataType::FieldType;
132
4
                using ToFieldType = typename ToDataType::FieldType;
133
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
4
                UInt32 from_scale = 0;
135
136
4
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
4
                    const auto* from_decimal_type =
138
4
                            check_and_get_data_type<FromDataType>(from_type.get());
139
4
                    from_precision =
140
4
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
4
                    from_scale = from_decimal_type->get_scale();
142
4
                }
143
144
4
                UInt32 to_max_digits = 0;
145
4
                UInt32 to_precision = 0;
146
4
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
4
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
4
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
4
                return narrow_integral || multiply_may_overflow;
173
4
            }
174
0
            return false;
175
4
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
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
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_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
122
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2
            using Types2 = std::decay_t<decltype(types2)>;
124
2
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
2
            return false;
175
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Line
Count
Source
122
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1
            using Types2 = std::decay_t<decltype(types2)>;
124
1
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1
                return false;
129
1
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1
            return false;
175
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
122
51
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
51
            using Types2 = std::decay_t<decltype(types2)>;
124
51
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
51
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
51
                return false;
129
51
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
51
            return false;
175
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
122
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1
            using Types2 = std::decay_t<decltype(types2)>;
124
1
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1
            return false;
175
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_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
122
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1
            using Types2 = std::decay_t<decltype(types2)>;
124
1
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1
            return false;
175
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_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
122
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1
            using Types2 = std::decay_t<decltype(types2)>;
124
1
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1
                using FromFieldType = typename FromDataType::FieldType;
132
1
                using ToFieldType = typename ToDataType::FieldType;
133
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1
                UInt32 from_scale = 0;
135
136
1
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
1
                    const auto* from_decimal_type =
138
1
                            check_and_get_data_type<FromDataType>(from_type.get());
139
1
                    from_precision =
140
1
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
1
                    from_scale = from_decimal_type->get_scale();
142
1
                }
143
144
1
                UInt32 to_max_digits = 0;
145
1
                UInt32 to_precision = 0;
146
1
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
1
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
1
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
1
                    to_precision = to_max_digits;
162
1
                }
163
164
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1
                if (to_scale > from_scale) {
169
0
                    multiply_may_overflow &=
170
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
0
                }
172
1
                return narrow_integral || multiply_may_overflow;
173
1
            }
174
0
            return false;
175
1
        });
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
122
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1
            using Types2 = std::decay_t<decltype(types2)>;
124
1
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
                return false;
129
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
1
            return false;
175
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_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
122
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
12
            using Types2 = std::decay_t<decltype(types2)>;
124
12
            using FromDataType = typename Types2::LeftType;
125
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
12
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
12
                return false;
129
12
            }
130
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
                using FromFieldType = typename FromDataType::FieldType;
132
                using ToFieldType = typename ToDataType::FieldType;
133
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
                UInt32 from_scale = 0;
135
136
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
                    const auto* from_decimal_type =
138
                            check_and_get_data_type<FromDataType>(from_type.get());
139
                    from_precision =
140
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
                    from_scale = from_decimal_type->get_scale();
142
                }
143
144
                UInt32 to_max_digits = 0;
145
                UInt32 to_precision = 0;
146
                UInt32 to_scale = 0;
147
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
                    const auto* to_decimal_type =
152
                            check_and_get_data_type<ToDataType>(to_type.get());
153
                    to_precision = to_decimal_type->get_precision();
154
                    ToDataType::check_type_precision(to_precision);
155
156
                    to_scale = to_decimal_type->get_scale();
157
                    ToDataType::check_type_scale(to_scale);
158
                }
159
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
                    to_precision = to_max_digits;
162
                }
163
164
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
                if (to_scale > from_scale) {
169
                    multiply_may_overflow &=
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
                }
172
                return narrow_integral || multiply_may_overflow;
173
            }
174
12
            return false;
175
12
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
176
35.3k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
112
48
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
48
        using Types = std::decay_t<decltype(types)>;
114
48
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
48
        return call_on_index_and_data_type<
122
48
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
48
            using Types2 = std::decay_t<decltype(types2)>;
124
48
            using FromDataType = typename Types2::LeftType;
125
48
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
48
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
48
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
48
                return false;
129
48
            }
130
48
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
48
                using FromFieldType = typename FromDataType::FieldType;
132
48
                using ToFieldType = typename ToDataType::FieldType;
133
48
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
48
                UInt32 from_scale = 0;
135
136
48
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
48
                    const auto* from_decimal_type =
138
48
                            check_and_get_data_type<FromDataType>(from_type.get());
139
48
                    from_precision =
140
48
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
48
                    from_scale = from_decimal_type->get_scale();
142
48
                }
143
144
48
                UInt32 to_max_digits = 0;
145
48
                UInt32 to_precision = 0;
146
48
                UInt32 to_scale = 0;
147
148
48
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
48
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
48
                    const auto* to_decimal_type =
152
48
                            check_and_get_data_type<ToDataType>(to_type.get());
153
48
                    to_precision = to_decimal_type->get_precision();
154
48
                    ToDataType::check_type_precision(to_precision);
155
156
48
                    to_scale = to_decimal_type->get_scale();
157
48
                    ToDataType::check_type_scale(to_scale);
158
48
                }
159
48
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
48
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
48
                    to_precision = to_max_digits;
162
48
                }
163
164
48
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
48
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
48
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
48
                if (to_scale > from_scale) {
169
48
                    multiply_may_overflow &=
170
48
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
48
                }
172
48
                return narrow_integral || multiply_may_overflow;
173
48
            }
174
48
            return false;
175
48
        });
176
48
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
112
1.44k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
1.44k
        using Types = std::decay_t<decltype(types)>;
114
1.44k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
1.44k
        return call_on_index_and_data_type<
122
1.44k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.44k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.44k
            using FromDataType = typename Types2::LeftType;
125
1.44k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
1.44k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1.44k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1.44k
                return false;
129
1.44k
            }
130
1.44k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1.44k
                using FromFieldType = typename FromDataType::FieldType;
132
1.44k
                using ToFieldType = typename ToDataType::FieldType;
133
1.44k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1.44k
                UInt32 from_scale = 0;
135
136
1.44k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
1.44k
                    const auto* from_decimal_type =
138
1.44k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
1.44k
                    from_precision =
140
1.44k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
1.44k
                    from_scale = from_decimal_type->get_scale();
142
1.44k
                }
143
144
1.44k
                UInt32 to_max_digits = 0;
145
1.44k
                UInt32 to_precision = 0;
146
1.44k
                UInt32 to_scale = 0;
147
148
1.44k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1.44k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1.44k
                    const auto* to_decimal_type =
152
1.44k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1.44k
                    to_precision = to_decimal_type->get_precision();
154
1.44k
                    ToDataType::check_type_precision(to_precision);
155
156
1.44k
                    to_scale = to_decimal_type->get_scale();
157
1.44k
                    ToDataType::check_type_scale(to_scale);
158
1.44k
                }
159
1.44k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
1.44k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
1.44k
                    to_precision = to_max_digits;
162
1.44k
                }
163
164
1.44k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1.44k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1.44k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1.44k
                if (to_scale > from_scale) {
169
1.44k
                    multiply_may_overflow &=
170
1.44k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
1.44k
                }
172
1.44k
                return narrow_integral || multiply_may_overflow;
173
1.44k
            }
174
1.44k
            return false;
175
1.44k
        });
176
1.44k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
112
1.42k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
1.42k
        using Types = std::decay_t<decltype(types)>;
114
1.42k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
1.42k
        return call_on_index_and_data_type<
122
1.42k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.42k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.42k
            using FromDataType = typename Types2::LeftType;
125
1.42k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
1.42k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1.42k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1.42k
                return false;
129
1.42k
            }
130
1.42k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1.42k
                using FromFieldType = typename FromDataType::FieldType;
132
1.42k
                using ToFieldType = typename ToDataType::FieldType;
133
1.42k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1.42k
                UInt32 from_scale = 0;
135
136
1.42k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
1.42k
                    const auto* from_decimal_type =
138
1.42k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
1.42k
                    from_precision =
140
1.42k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
1.42k
                    from_scale = from_decimal_type->get_scale();
142
1.42k
                }
143
144
1.42k
                UInt32 to_max_digits = 0;
145
1.42k
                UInt32 to_precision = 0;
146
1.42k
                UInt32 to_scale = 0;
147
148
1.42k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1.42k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1.42k
                    const auto* to_decimal_type =
152
1.42k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1.42k
                    to_precision = to_decimal_type->get_precision();
154
1.42k
                    ToDataType::check_type_precision(to_precision);
155
156
1.42k
                    to_scale = to_decimal_type->get_scale();
157
1.42k
                    ToDataType::check_type_scale(to_scale);
158
1.42k
                }
159
1.42k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
1.42k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
1.42k
                    to_precision = to_max_digits;
162
1.42k
                }
163
164
1.42k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1.42k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1.42k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1.42k
                if (to_scale > from_scale) {
169
1.42k
                    multiply_may_overflow &=
170
1.42k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
1.42k
                }
172
1.42k
                return narrow_integral || multiply_may_overflow;
173
1.42k
            }
174
1.42k
            return false;
175
1.42k
        });
176
1.42k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
112
1.31k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
1.31k
        using Types = std::decay_t<decltype(types)>;
114
1.31k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
1.31k
        return call_on_index_and_data_type<
122
1.31k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.31k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.31k
            using FromDataType = typename Types2::LeftType;
125
1.31k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
1.31k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1.31k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1.31k
                return false;
129
1.31k
            }
130
1.31k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1.31k
                using FromFieldType = typename FromDataType::FieldType;
132
1.31k
                using ToFieldType = typename ToDataType::FieldType;
133
1.31k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1.31k
                UInt32 from_scale = 0;
135
136
1.31k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
1.31k
                    const auto* from_decimal_type =
138
1.31k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
1.31k
                    from_precision =
140
1.31k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
1.31k
                    from_scale = from_decimal_type->get_scale();
142
1.31k
                }
143
144
1.31k
                UInt32 to_max_digits = 0;
145
1.31k
                UInt32 to_precision = 0;
146
1.31k
                UInt32 to_scale = 0;
147
148
1.31k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1.31k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1.31k
                    const auto* to_decimal_type =
152
1.31k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1.31k
                    to_precision = to_decimal_type->get_precision();
154
1.31k
                    ToDataType::check_type_precision(to_precision);
155
156
1.31k
                    to_scale = to_decimal_type->get_scale();
157
1.31k
                    ToDataType::check_type_scale(to_scale);
158
1.31k
                }
159
1.31k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
1.31k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
1.31k
                    to_precision = to_max_digits;
162
1.31k
                }
163
164
1.31k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1.31k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1.31k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1.31k
                if (to_scale > from_scale) {
169
1.31k
                    multiply_may_overflow &=
170
1.31k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
1.31k
                }
172
1.31k
                return narrow_integral || multiply_may_overflow;
173
1.31k
            }
174
1.31k
            return false;
175
1.31k
        });
176
1.31k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
112
1.03k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
1.03k
        using Types = std::decay_t<decltype(types)>;
114
1.03k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
1.03k
        return call_on_index_and_data_type<
122
1.03k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.03k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.03k
            using FromDataType = typename Types2::LeftType;
125
1.03k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
1.03k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1.03k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1.03k
                return false;
129
1.03k
            }
130
1.03k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1.03k
                using FromFieldType = typename FromDataType::FieldType;
132
1.03k
                using ToFieldType = typename ToDataType::FieldType;
133
1.03k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1.03k
                UInt32 from_scale = 0;
135
136
1.03k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
1.03k
                    const auto* from_decimal_type =
138
1.03k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
1.03k
                    from_precision =
140
1.03k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
1.03k
                    from_scale = from_decimal_type->get_scale();
142
1.03k
                }
143
144
1.03k
                UInt32 to_max_digits = 0;
145
1.03k
                UInt32 to_precision = 0;
146
1.03k
                UInt32 to_scale = 0;
147
148
1.03k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1.03k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1.03k
                    const auto* to_decimal_type =
152
1.03k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1.03k
                    to_precision = to_decimal_type->get_precision();
154
1.03k
                    ToDataType::check_type_precision(to_precision);
155
156
1.03k
                    to_scale = to_decimal_type->get_scale();
157
1.03k
                    ToDataType::check_type_scale(to_scale);
158
1.03k
                }
159
1.03k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
1.03k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
1.03k
                    to_precision = to_max_digits;
162
1.03k
                }
163
164
1.03k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1.03k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1.03k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1.03k
                if (to_scale > from_scale) {
169
1.03k
                    multiply_may_overflow &=
170
1.03k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
1.03k
                }
172
1.03k
                return narrow_integral || multiply_may_overflow;
173
1.03k
            }
174
1.03k
            return false;
175
1.03k
        });
176
1.03k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
112
1.10k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
1.10k
        using Types = std::decay_t<decltype(types)>;
114
1.10k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
1.10k
        return call_on_index_and_data_type<
122
1.10k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1.10k
            using Types2 = std::decay_t<decltype(types2)>;
124
1.10k
            using FromDataType = typename Types2::LeftType;
125
1.10k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
1.10k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1.10k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1.10k
                return false;
129
1.10k
            }
130
1.10k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1.10k
                using FromFieldType = typename FromDataType::FieldType;
132
1.10k
                using ToFieldType = typename ToDataType::FieldType;
133
1.10k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1.10k
                UInt32 from_scale = 0;
135
136
1.10k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
1.10k
                    const auto* from_decimal_type =
138
1.10k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
1.10k
                    from_precision =
140
1.10k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
1.10k
                    from_scale = from_decimal_type->get_scale();
142
1.10k
                }
143
144
1.10k
                UInt32 to_max_digits = 0;
145
1.10k
                UInt32 to_precision = 0;
146
1.10k
                UInt32 to_scale = 0;
147
148
1.10k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1.10k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1.10k
                    const auto* to_decimal_type =
152
1.10k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1.10k
                    to_precision = to_decimal_type->get_precision();
154
1.10k
                    ToDataType::check_type_precision(to_precision);
155
156
1.10k
                    to_scale = to_decimal_type->get_scale();
157
1.10k
                    ToDataType::check_type_scale(to_scale);
158
1.10k
                }
159
1.10k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
1.10k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
1.10k
                    to_precision = to_max_digits;
162
1.10k
                }
163
164
1.10k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1.10k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1.10k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1.10k
                if (to_scale > from_scale) {
169
1.10k
                    multiply_may_overflow &=
170
1.10k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
1.10k
                }
172
1.10k
                return narrow_integral || multiply_may_overflow;
173
1.10k
            }
174
1.10k
            return false;
175
1.10k
        });
176
1.10k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
112
8.17k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
8.17k
        using Types = std::decay_t<decltype(types)>;
114
8.17k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
8.17k
        return call_on_index_and_data_type<
122
8.17k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8.17k
            using Types2 = std::decay_t<decltype(types2)>;
124
8.17k
            using FromDataType = typename Types2::LeftType;
125
8.17k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
8.17k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
8.17k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
8.17k
                return false;
129
8.17k
            }
130
8.17k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
8.17k
                using FromFieldType = typename FromDataType::FieldType;
132
8.17k
                using ToFieldType = typename ToDataType::FieldType;
133
8.17k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
8.17k
                UInt32 from_scale = 0;
135
136
8.17k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
8.17k
                    const auto* from_decimal_type =
138
8.17k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
8.17k
                    from_precision =
140
8.17k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
8.17k
                    from_scale = from_decimal_type->get_scale();
142
8.17k
                }
143
144
8.17k
                UInt32 to_max_digits = 0;
145
8.17k
                UInt32 to_precision = 0;
146
8.17k
                UInt32 to_scale = 0;
147
148
8.17k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
8.17k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
8.17k
                    const auto* to_decimal_type =
152
8.17k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
8.17k
                    to_precision = to_decimal_type->get_precision();
154
8.17k
                    ToDataType::check_type_precision(to_precision);
155
156
8.17k
                    to_scale = to_decimal_type->get_scale();
157
8.17k
                    ToDataType::check_type_scale(to_scale);
158
8.17k
                }
159
8.17k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
8.17k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
8.17k
                    to_precision = to_max_digits;
162
8.17k
                }
163
164
8.17k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
8.17k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
8.17k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
8.17k
                if (to_scale > from_scale) {
169
8.17k
                    multiply_may_overflow &=
170
8.17k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
8.17k
                }
172
8.17k
                return narrow_integral || multiply_may_overflow;
173
8.17k
            }
174
8.17k
            return false;
175
8.17k
        });
176
8.17k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
112
8.23k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
8.23k
        using Types = std::decay_t<decltype(types)>;
114
8.23k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
8.23k
        return call_on_index_and_data_type<
122
8.23k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
8.23k
            using Types2 = std::decay_t<decltype(types2)>;
124
8.23k
            using FromDataType = typename Types2::LeftType;
125
8.23k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
8.23k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
8.23k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
8.23k
                return false;
129
8.23k
            }
130
8.23k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
8.23k
                using FromFieldType = typename FromDataType::FieldType;
132
8.23k
                using ToFieldType = typename ToDataType::FieldType;
133
8.23k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
8.23k
                UInt32 from_scale = 0;
135
136
8.23k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
8.23k
                    const auto* from_decimal_type =
138
8.23k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
8.23k
                    from_precision =
140
8.23k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
8.23k
                    from_scale = from_decimal_type->get_scale();
142
8.23k
                }
143
144
8.23k
                UInt32 to_max_digits = 0;
145
8.23k
                UInt32 to_precision = 0;
146
8.23k
                UInt32 to_scale = 0;
147
148
8.23k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
8.23k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
8.23k
                    const auto* to_decimal_type =
152
8.23k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
8.23k
                    to_precision = to_decimal_type->get_precision();
154
8.23k
                    ToDataType::check_type_precision(to_precision);
155
156
8.23k
                    to_scale = to_decimal_type->get_scale();
157
8.23k
                    ToDataType::check_type_scale(to_scale);
158
8.23k
                }
159
8.23k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
8.23k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
8.23k
                    to_precision = to_max_digits;
162
8.23k
                }
163
164
8.23k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
8.23k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
8.23k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
8.23k
                if (to_scale > from_scale) {
169
8.23k
                    multiply_may_overflow &=
170
8.23k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
8.23k
                }
172
8.23k
                return narrow_integral || multiply_may_overflow;
173
8.23k
            }
174
8.23k
            return false;
175
8.23k
        });
176
8.23k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
112
3.23k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
3.23k
        using Types = std::decay_t<decltype(types)>;
114
3.23k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
3.23k
        return call_on_index_and_data_type<
122
3.23k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
3.23k
            using Types2 = std::decay_t<decltype(types2)>;
124
3.23k
            using FromDataType = typename Types2::LeftType;
125
3.23k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
3.23k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
3.23k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
3.23k
                return false;
129
3.23k
            }
130
3.23k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
3.23k
                using FromFieldType = typename FromDataType::FieldType;
132
3.23k
                using ToFieldType = typename ToDataType::FieldType;
133
3.23k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
3.23k
                UInt32 from_scale = 0;
135
136
3.23k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
3.23k
                    const auto* from_decimal_type =
138
3.23k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
3.23k
                    from_precision =
140
3.23k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
3.23k
                    from_scale = from_decimal_type->get_scale();
142
3.23k
                }
143
144
3.23k
                UInt32 to_max_digits = 0;
145
3.23k
                UInt32 to_precision = 0;
146
3.23k
                UInt32 to_scale = 0;
147
148
3.23k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
3.23k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
3.23k
                    const auto* to_decimal_type =
152
3.23k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
3.23k
                    to_precision = to_decimal_type->get_precision();
154
3.23k
                    ToDataType::check_type_precision(to_precision);
155
156
3.23k
                    to_scale = to_decimal_type->get_scale();
157
3.23k
                    ToDataType::check_type_scale(to_scale);
158
3.23k
                }
159
3.23k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
3.23k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
3.23k
                    to_precision = to_max_digits;
162
3.23k
                }
163
164
3.23k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
3.23k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
3.23k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
3.23k
                if (to_scale > from_scale) {
169
3.23k
                    multiply_may_overflow &=
170
3.23k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
3.23k
                }
172
3.23k
                return narrow_integral || multiply_may_overflow;
173
3.23k
            }
174
3.23k
            return false;
175
3.23k
        });
176
3.23k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
112
3.21k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
3.21k
        using Types = std::decay_t<decltype(types)>;
114
3.21k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
3.21k
        return call_on_index_and_data_type<
122
3.21k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
3.21k
            using Types2 = std::decay_t<decltype(types2)>;
124
3.21k
            using FromDataType = typename Types2::LeftType;
125
3.21k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
3.21k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
3.21k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
3.21k
                return false;
129
3.21k
            }
130
3.21k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
3.21k
                using FromFieldType = typename FromDataType::FieldType;
132
3.21k
                using ToFieldType = typename ToDataType::FieldType;
133
3.21k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
3.21k
                UInt32 from_scale = 0;
135
136
3.21k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
3.21k
                    const auto* from_decimal_type =
138
3.21k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
3.21k
                    from_precision =
140
3.21k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
3.21k
                    from_scale = from_decimal_type->get_scale();
142
3.21k
                }
143
144
3.21k
                UInt32 to_max_digits = 0;
145
3.21k
                UInt32 to_precision = 0;
146
3.21k
                UInt32 to_scale = 0;
147
148
3.21k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
3.21k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
3.21k
                    const auto* to_decimal_type =
152
3.21k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
3.21k
                    to_precision = to_decimal_type->get_precision();
154
3.21k
                    ToDataType::check_type_precision(to_precision);
155
156
3.21k
                    to_scale = to_decimal_type->get_scale();
157
3.21k
                    ToDataType::check_type_scale(to_scale);
158
3.21k
                }
159
3.21k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
3.21k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
3.21k
                    to_precision = to_max_digits;
162
3.21k
                }
163
164
3.21k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
3.21k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
3.21k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
3.21k
                if (to_scale > from_scale) {
169
3.21k
                    multiply_may_overflow &=
170
3.21k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
3.21k
                }
172
3.21k
                return narrow_integral || multiply_may_overflow;
173
3.21k
            }
174
3.21k
            return false;
175
3.21k
        });
176
3.21k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
112
4
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
4
        using Types = std::decay_t<decltype(types)>;
114
4
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
4
        return call_on_index_and_data_type<
122
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
4
            using Types2 = std::decay_t<decltype(types2)>;
124
4
            using FromDataType = typename Types2::LeftType;
125
4
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
4
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
4
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
4
                return false;
129
4
            }
130
4
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
4
                using FromFieldType = typename FromDataType::FieldType;
132
4
                using ToFieldType = typename ToDataType::FieldType;
133
4
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
4
                UInt32 from_scale = 0;
135
136
4
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
4
                    const auto* from_decimal_type =
138
4
                            check_and_get_data_type<FromDataType>(from_type.get());
139
4
                    from_precision =
140
4
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
4
                    from_scale = from_decimal_type->get_scale();
142
4
                }
143
144
4
                UInt32 to_max_digits = 0;
145
4
                UInt32 to_precision = 0;
146
4
                UInt32 to_scale = 0;
147
148
4
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
4
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
4
                    const auto* to_decimal_type =
152
4
                            check_and_get_data_type<ToDataType>(to_type.get());
153
4
                    to_precision = to_decimal_type->get_precision();
154
4
                    ToDataType::check_type_precision(to_precision);
155
156
4
                    to_scale = to_decimal_type->get_scale();
157
4
                    ToDataType::check_type_scale(to_scale);
158
4
                }
159
4
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
4
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
4
                    to_precision = to_max_digits;
162
4
                }
163
164
4
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
4
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
4
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
4
                if (to_scale > from_scale) {
169
4
                    multiply_may_overflow &=
170
4
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
4
                }
172
4
                return narrow_integral || multiply_may_overflow;
173
4
            }
174
4
            return false;
175
4
        });
176
4
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
112
3.01k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
3.01k
        using Types = std::decay_t<decltype(types)>;
114
3.01k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
3.01k
        return call_on_index_and_data_type<
122
3.01k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
3.01k
            using Types2 = std::decay_t<decltype(types2)>;
124
3.01k
            using FromDataType = typename Types2::LeftType;
125
3.01k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
3.01k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
3.01k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
3.01k
                return false;
129
3.01k
            }
130
3.01k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
3.01k
                using FromFieldType = typename FromDataType::FieldType;
132
3.01k
                using ToFieldType = typename ToDataType::FieldType;
133
3.01k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
3.01k
                UInt32 from_scale = 0;
135
136
3.01k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
3.01k
                    const auto* from_decimal_type =
138
3.01k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
3.01k
                    from_precision =
140
3.01k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
3.01k
                    from_scale = from_decimal_type->get_scale();
142
3.01k
                }
143
144
3.01k
                UInt32 to_max_digits = 0;
145
3.01k
                UInt32 to_precision = 0;
146
3.01k
                UInt32 to_scale = 0;
147
148
3.01k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
3.01k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
3.01k
                    const auto* to_decimal_type =
152
3.01k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
3.01k
                    to_precision = to_decimal_type->get_precision();
154
3.01k
                    ToDataType::check_type_precision(to_precision);
155
156
3.01k
                    to_scale = to_decimal_type->get_scale();
157
3.01k
                    ToDataType::check_type_scale(to_scale);
158
3.01k
                }
159
3.01k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
3.01k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
3.01k
                    to_precision = to_max_digits;
162
3.01k
                }
163
164
3.01k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
3.01k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
3.01k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
3.01k
                if (to_scale > from_scale) {
169
3.01k
                    multiply_may_overflow &=
170
3.01k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
3.01k
                }
172
3.01k
                return narrow_integral || multiply_may_overflow;
173
3.01k
            }
174
3.01k
            return false;
175
3.01k
        });
176
3.01k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_
Line
Count
Source
112
2.84k
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
2.84k
        using Types = std::decay_t<decltype(types)>;
114
2.84k
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
2.84k
        return call_on_index_and_data_type<
122
2.84k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
2.84k
            using Types2 = std::decay_t<decltype(types2)>;
124
2.84k
            using FromDataType = typename Types2::LeftType;
125
2.84k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
2.84k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
2.84k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
2.84k
                return false;
129
2.84k
            }
130
2.84k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
2.84k
                using FromFieldType = typename FromDataType::FieldType;
132
2.84k
                using ToFieldType = typename ToDataType::FieldType;
133
2.84k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
2.84k
                UInt32 from_scale = 0;
135
136
2.84k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
2.84k
                    const auto* from_decimal_type =
138
2.84k
                            check_and_get_data_type<FromDataType>(from_type.get());
139
2.84k
                    from_precision =
140
2.84k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
2.84k
                    from_scale = from_decimal_type->get_scale();
142
2.84k
                }
143
144
2.84k
                UInt32 to_max_digits = 0;
145
2.84k
                UInt32 to_precision = 0;
146
2.84k
                UInt32 to_scale = 0;
147
148
2.84k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
2.84k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
2.84k
                    const auto* to_decimal_type =
152
2.84k
                            check_and_get_data_type<ToDataType>(to_type.get());
153
2.84k
                    to_precision = to_decimal_type->get_precision();
154
2.84k
                    ToDataType::check_type_precision(to_precision);
155
156
2.84k
                    to_scale = to_decimal_type->get_scale();
157
2.84k
                    ToDataType::check_type_scale(to_scale);
158
2.84k
                }
159
2.84k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
2.84k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
2.84k
                    to_precision = to_max_digits;
162
2.84k
                }
163
164
2.84k
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
2.84k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
2.84k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
2.84k
                if (to_scale > from_scale) {
169
2.84k
                    multiply_may_overflow &=
170
2.84k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
2.84k
                }
172
2.84k
                return narrow_integral || multiply_may_overflow;
173
2.84k
            }
174
2.84k
            return false;
175
2.84k
        });
176
2.84k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_
Line
Count
Source
112
1
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
1
        using Types = std::decay_t<decltype(types)>;
114
1
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
1
        return call_on_index_and_data_type<
122
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
1
            using Types2 = std::decay_t<decltype(types2)>;
124
1
            using FromDataType = typename Types2::LeftType;
125
1
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
1
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
1
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
1
                return false;
129
1
            }
130
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
1
                using FromFieldType = typename FromDataType::FieldType;
132
1
                using ToFieldType = typename ToDataType::FieldType;
133
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
1
                UInt32 from_scale = 0;
135
136
1
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
1
                    const auto* from_decimal_type =
138
1
                            check_and_get_data_type<FromDataType>(from_type.get());
139
1
                    from_precision =
140
1
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
1
                    from_scale = from_decimal_type->get_scale();
142
1
                }
143
144
1
                UInt32 to_max_digits = 0;
145
1
                UInt32 to_precision = 0;
146
1
                UInt32 to_scale = 0;
147
148
1
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
1
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
1
                    const auto* to_decimal_type =
152
1
                            check_and_get_data_type<ToDataType>(to_type.get());
153
1
                    to_precision = to_decimal_type->get_precision();
154
1
                    ToDataType::check_type_precision(to_precision);
155
156
1
                    to_scale = to_decimal_type->get_scale();
157
1
                    ToDataType::check_type_scale(to_scale);
158
1
                }
159
1
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
1
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
1
                    to_precision = to_max_digits;
162
1
                }
163
164
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
1
                if (to_scale > from_scale) {
169
1
                    multiply_may_overflow &=
170
1
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
1
                }
172
1
                return narrow_integral || multiply_may_overflow;
173
1
            }
174
1
            return false;
175
1
        });
176
1
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_
Line
Count
Source
112
72
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
72
        using Types = std::decay_t<decltype(types)>;
114
72
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
72
        return call_on_index_and_data_type<
122
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
72
            using Types2 = std::decay_t<decltype(types2)>;
124
72
            using FromDataType = typename Types2::LeftType;
125
72
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
72
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
72
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
72
                return false;
129
72
            }
130
72
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
72
                using FromFieldType = typename FromDataType::FieldType;
132
72
                using ToFieldType = typename ToDataType::FieldType;
133
72
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
72
                UInt32 from_scale = 0;
135
136
72
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
72
                    const auto* from_decimal_type =
138
72
                            check_and_get_data_type<FromDataType>(from_type.get());
139
72
                    from_precision =
140
72
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
72
                    from_scale = from_decimal_type->get_scale();
142
72
                }
143
144
72
                UInt32 to_max_digits = 0;
145
72
                UInt32 to_precision = 0;
146
72
                UInt32 to_scale = 0;
147
148
72
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
72
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
72
                    const auto* to_decimal_type =
152
72
                            check_and_get_data_type<ToDataType>(to_type.get());
153
72
                    to_precision = to_decimal_type->get_precision();
154
72
                    ToDataType::check_type_precision(to_precision);
155
156
72
                    to_scale = to_decimal_type->get_scale();
157
72
                    ToDataType::check_type_scale(to_scale);
158
72
                }
159
72
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
72
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
72
                    to_precision = to_max_digits;
162
72
                }
163
164
72
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
72
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
72
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
72
                if (to_scale > from_scale) {
169
72
                    multiply_may_overflow &=
170
72
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
72
                }
172
72
                return narrow_integral || multiply_may_overflow;
173
72
            }
174
72
            return false;
175
72
        });
176
72
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
112
74
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
74
        using Types = std::decay_t<decltype(types)>;
114
74
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
74
        return call_on_index_and_data_type<
122
74
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
74
            using Types2 = std::decay_t<decltype(types2)>;
124
74
            using FromDataType = typename Types2::LeftType;
125
74
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
74
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
74
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
74
                return false;
129
74
            }
130
74
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
74
                using FromFieldType = typename FromDataType::FieldType;
132
74
                using ToFieldType = typename ToDataType::FieldType;
133
74
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
74
                UInt32 from_scale = 0;
135
136
74
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
74
                    const auto* from_decimal_type =
138
74
                            check_and_get_data_type<FromDataType>(from_type.get());
139
74
                    from_precision =
140
74
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
74
                    from_scale = from_decimal_type->get_scale();
142
74
                }
143
144
74
                UInt32 to_max_digits = 0;
145
74
                UInt32 to_precision = 0;
146
74
                UInt32 to_scale = 0;
147
148
74
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
74
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
74
                    const auto* to_decimal_type =
152
74
                            check_and_get_data_type<ToDataType>(to_type.get());
153
74
                    to_precision = to_decimal_type->get_precision();
154
74
                    ToDataType::check_type_precision(to_precision);
155
156
74
                    to_scale = to_decimal_type->get_scale();
157
74
                    ToDataType::check_type_scale(to_scale);
158
74
                }
159
74
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
74
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
74
                    to_precision = to_max_digits;
162
74
                }
163
164
74
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
74
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
74
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
74
                if (to_scale > from_scale) {
169
74
                    multiply_may_overflow &=
170
74
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
74
                }
172
74
                return narrow_integral || multiply_may_overflow;
173
74
            }
174
74
            return false;
175
74
        });
176
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
112
16
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
16
        using Types = std::decay_t<decltype(types)>;
114
16
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
            return false;
120
        }
121
16
        return call_on_index_and_data_type<
122
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
16
            using Types2 = std::decay_t<decltype(types2)>;
124
16
            using FromDataType = typename Types2::LeftType;
125
16
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
16
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
16
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
16
                return false;
129
16
            }
130
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
16
                using FromFieldType = typename FromDataType::FieldType;
132
16
                using ToFieldType = typename ToDataType::FieldType;
133
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
16
                UInt32 from_scale = 0;
135
136
16
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
16
                    const auto* from_decimal_type =
138
16
                            check_and_get_data_type<FromDataType>(from_type.get());
139
16
                    from_precision =
140
16
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
16
                    from_scale = from_decimal_type->get_scale();
142
16
                }
143
144
16
                UInt32 to_max_digits = 0;
145
16
                UInt32 to_precision = 0;
146
16
                UInt32 to_scale = 0;
147
148
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
16
                    const auto* to_decimal_type =
152
16
                            check_and_get_data_type<ToDataType>(to_type.get());
153
16
                    to_precision = to_decimal_type->get_precision();
154
16
                    ToDataType::check_type_precision(to_precision);
155
156
16
                    to_scale = to_decimal_type->get_scale();
157
16
                    ToDataType::check_type_scale(to_scale);
158
16
                }
159
16
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
16
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
16
                    to_precision = to_max_digits;
162
16
                }
163
164
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
16
                if (to_scale > from_scale) {
169
16
                    multiply_may_overflow &=
170
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
16
                }
172
16
                return narrow_integral || multiply_may_overflow;
173
16
            }
174
16
            return false;
175
16
        });
176
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
112
7
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
7
        using Types = std::decay_t<decltype(types)>;
114
7
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
7
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
7
            return false;
120
7
        }
121
0
        return call_on_index_and_data_type<
122
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
7
            using Types2 = std::decay_t<decltype(types2)>;
124
7
            using FromDataType = typename Types2::LeftType;
125
7
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
7
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
7
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
7
                return false;
129
7
            }
130
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
7
                using FromFieldType = typename FromDataType::FieldType;
132
7
                using ToFieldType = typename ToDataType::FieldType;
133
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
7
                UInt32 from_scale = 0;
135
136
7
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
7
                    const auto* from_decimal_type =
138
7
                            check_and_get_data_type<FromDataType>(from_type.get());
139
7
                    from_precision =
140
7
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
7
                    from_scale = from_decimal_type->get_scale();
142
7
                }
143
144
7
                UInt32 to_max_digits = 0;
145
7
                UInt32 to_precision = 0;
146
7
                UInt32 to_scale = 0;
147
148
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
7
                    const auto* to_decimal_type =
152
7
                            check_and_get_data_type<ToDataType>(to_type.get());
153
7
                    to_precision = to_decimal_type->get_precision();
154
7
                    ToDataType::check_type_precision(to_precision);
155
156
7
                    to_scale = to_decimal_type->get_scale();
157
7
                    ToDataType::check_type_scale(to_scale);
158
7
                }
159
7
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
7
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
7
                    to_precision = to_max_digits;
162
7
                }
163
164
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
7
                if (to_scale > from_scale) {
169
7
                    multiply_may_overflow &=
170
7
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
7
                }
172
7
                return narrow_integral || multiply_may_overflow;
173
7
            }
174
7
            return false;
175
7
        });
176
7
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_
Line
Count
Source
112
10
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
10
        using Types = std::decay_t<decltype(types)>;
114
10
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
10
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
10
            return false;
120
10
        }
121
0
        return call_on_index_and_data_type<
122
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
10
            using Types2 = std::decay_t<decltype(types2)>;
124
10
            using FromDataType = typename Types2::LeftType;
125
10
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
10
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
10
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
10
                return false;
129
10
            }
130
10
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
10
                using FromFieldType = typename FromDataType::FieldType;
132
10
                using ToFieldType = typename ToDataType::FieldType;
133
10
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
10
                UInt32 from_scale = 0;
135
136
10
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
10
                    const auto* from_decimal_type =
138
10
                            check_and_get_data_type<FromDataType>(from_type.get());
139
10
                    from_precision =
140
10
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
10
                    from_scale = from_decimal_type->get_scale();
142
10
                }
143
144
10
                UInt32 to_max_digits = 0;
145
10
                UInt32 to_precision = 0;
146
10
                UInt32 to_scale = 0;
147
148
10
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
10
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
10
                    const auto* to_decimal_type =
152
10
                            check_and_get_data_type<ToDataType>(to_type.get());
153
10
                    to_precision = to_decimal_type->get_precision();
154
10
                    ToDataType::check_type_precision(to_precision);
155
156
10
                    to_scale = to_decimal_type->get_scale();
157
10
                    ToDataType::check_type_scale(to_scale);
158
10
                }
159
10
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
10
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
10
                    to_precision = to_max_digits;
162
10
                }
163
164
10
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
10
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
10
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
10
                if (to_scale > from_scale) {
169
10
                    multiply_may_overflow &=
170
10
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
10
                }
172
10
                return narrow_integral || multiply_may_overflow;
173
10
            }
174
10
            return false;
175
10
        });
176
10
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_
Line
Count
Source
112
43
    auto make_default_wrapper = [&](const auto& types) -> bool {
113
43
        using Types = std::decay_t<decltype(types)>;
114
43
        using ToDataType = typename Types::LeftType;
115
116
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
117
                        IsDatelikeV2Types<ToDataType> ||
118
43
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
119
43
            return false;
120
43
        }
121
0
        return call_on_index_and_data_type<
122
43
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
123
43
            using Types2 = std::decay_t<decltype(types2)>;
124
43
            using FromDataType = typename Types2::LeftType;
125
43
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
126
43
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
127
43
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
128
43
                return false;
129
43
            }
130
43
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
131
43
                using FromFieldType = typename FromDataType::FieldType;
132
43
                using ToFieldType = typename ToDataType::FieldType;
133
43
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
134
43
                UInt32 from_scale = 0;
135
136
43
                if constexpr (IsDataTypeDecimal<FromDataType>) {
137
43
                    const auto* from_decimal_type =
138
43
                            check_and_get_data_type<FromDataType>(from_type.get());
139
43
                    from_precision =
140
43
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
141
43
                    from_scale = from_decimal_type->get_scale();
142
43
                }
143
144
43
                UInt32 to_max_digits = 0;
145
43
                UInt32 to_precision = 0;
146
43
                UInt32 to_scale = 0;
147
148
43
                if constexpr (IsDataTypeDecimal<ToDataType>) {
149
43
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
150
151
43
                    const auto* to_decimal_type =
152
43
                            check_and_get_data_type<ToDataType>(to_type.get());
153
43
                    to_precision = to_decimal_type->get_precision();
154
43
                    ToDataType::check_type_precision(to_precision);
155
156
43
                    to_scale = to_decimal_type->get_scale();
157
43
                    ToDataType::check_type_scale(to_scale);
158
43
                }
159
43
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
160
43
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
161
43
                    to_precision = to_max_digits;
162
43
                }
163
164
43
                bool narrow_integral = context->check_overflow_for_decimal() &&
165
43
                                       (to_precision - to_scale) <= (from_precision - from_scale);
166
167
43
                bool multiply_may_overflow = context->check_overflow_for_decimal();
168
43
                if (to_scale > from_scale) {
169
43
                    multiply_may_overflow &=
170
43
                            (from_precision + to_scale - from_scale) >= to_max_digits;
171
43
                }
172
43
                return narrow_integral || multiply_may_overflow;
173
43
            }
174
43
            return false;
175
43
        });
176
43
    };
177
178
85.3k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
179
85.4k
}
180
181
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
182
85.4k
                                    const DataTypePtr& to_type) {
183
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
184
85.4k
    bool result_is_nullable = to_type->is_nullable();
185
186
85.4k
    if (result_is_nullable) {
187
85.4k
        return [from_type, to_type](FunctionContext* context, Block& block,
188
85.4k
                                    const ColumnNumbers& arguments, uint32_t result,
189
85.4k
                                    size_t input_rows_count,
190
85.4k
                                    const NullMap::value_type* null_map = nullptr) {
191
85.4k
            auto from_type_not_nullable = remove_nullable(from_type);
192
85.4k
            auto to_type_not_nullable = remove_nullable(to_type);
193
194
85.4k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
195
85.4k
                    context, from_type_not_nullable, to_type_not_nullable);
196
197
85.4k
            auto nested_result_index = block.columns();
198
85.4k
            block.insert(block.get_by_position(result).unnest_nullable());
199
85.4k
            auto nested_source_index = block.columns();
200
85.4k
            block.insert(block.get_by_position(arguments[0])
201
85.4k
                                 .unnest_nullable(replace_null_data_to_default));
202
203
85.4k
            const auto& arg_col = block.get_by_position(arguments[0]);
204
85.4k
            const NullMap::value_type* arg_null_map = nullptr;
205
85.4k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
206
85.4k
                arg_null_map = nullable->get_null_map_data().data();
207
85.4k
            }
208
85.4k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
209
85.4k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
210
85.4k
                    arg_null_map));
211
212
61.7k
            block.get_by_position(result).column =
213
61.7k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
214
61.7k
                                     arguments, input_rows_count);
215
216
61.7k
            block.erase(nested_source_index);
217
61.7k
            block.erase(nested_result_index);
218
61.7k
            return Status::OK();
219
85.4k
        };
220
85.4k
    } else {
221
25
        return prepare_impl(context, from_type, to_type);
222
25
    }
223
85.4k
}
224
225
/// 'from_type' and 'to_type' are nested types in case of Nullable.
226
/// 'requested_result_is_nullable' is true if CAST to Nullable type is requested.
227
WrapperType prepare_impl(FunctionContext* context, const DataTypePtr& origin_from_type,
228
85.4k
                         const DataTypePtr& origin_to_type) {
229
85.4k
    auto to_type = get_serialized_type(origin_to_type);
230
85.4k
    auto from_type = get_serialized_type(origin_from_type);
231
85.4k
    if (from_type->equals(*to_type)) {
232
141
        return create_identity_wrapper(from_type);
233
141
    }
234
235
    // variant needs to be judged first
236
85.3k
    if (to_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
237
3
        if (variant_v2_enabled()) {
238
0
            return create_cast_to_variant_v2_wrapper(from_type);
239
0
        }
240
3
        return create_cast_to_variant_wrapper(from_type,
241
3
                                              static_cast<const DataTypeVariant&>(*to_type));
242
3
    }
243
85.3k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
244
23
        if (variant_v2_enabled()) {
245
0
            auto wrapper = create_cast_from_variant_v2_wrapper(to_type);
246
0
            return [wrapper = std::move(wrapper)](
247
0
                           FunctionContext* context, Block& block, const ColumnNumbers& arguments,
248
0
                           uint32_t result, size_t rows, const NullMap::value_type* null_map) {
249
0
                RETURN_IF_ERROR(wrapper(context, block, arguments, result, rows, null_map));
250
0
                auto& result_column = block.get_by_position(result).column;
251
0
                if (null_map == nullptr) {
252
0
                    const auto* nullable = check_and_get_column<ColumnNullable>(*result_column);
253
0
                    if (nullable != nullptr && !nullable->has_null()) {
254
0
                        result_column = nullable->get_nested_column_ptr();
255
0
                    }
256
0
                }
257
0
                return Status::OK();
258
0
            };
259
0
        }
260
23
        return create_cast_from_variant_wrapper(static_cast<const DataTypeVariant&>(*from_type),
261
23
                                                to_type);
262
23
    }
263
264
85.3k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
265
114
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
266
114
                                              to_type,
267
114
                                              context ? context->jsonb_string_as_string() : false);
268
114
    }
269
270
85.2k
    switch (to_type->get_primitive_type()) {
271
32
    case PrimitiveType::TYPE_BOOLEAN:
272
32
        return create_boolean_wrapper(context, from_type);
273
1.42k
    case PrimitiveType::TYPE_TINYINT:
274
2.83k
    case PrimitiveType::TYPE_SMALLINT:
275
4.13k
    case PrimitiveType::TYPE_INT:
276
5.16k
    case PrimitiveType::TYPE_BIGINT:
277
6.26k
    case PrimitiveType::TYPE_LARGEINT:
278
6.26k
        return create_int_wrapper(context, from_type, to_type->get_primitive_type());
279
8.17k
    case PrimitiveType::TYPE_FLOAT:
280
16.3k
    case PrimitiveType::TYPE_DOUBLE:
281
16.3k
        return create_float_wrapper(context, from_type, to_type->get_primitive_type());
282
1
    case PrimitiveType::TYPE_DATE:
283
1
    case PrimitiveType::TYPE_DATETIME:
284
73
    case PrimitiveType::TYPE_DATEV2:
285
147
    case PrimitiveType::TYPE_DATETIMEV2:
286
163
    case PrimitiveType::TYPE_TIMEV2:
287
163
        return create_datelike_wrapper(context, from_type, to_type->get_primitive_type());
288
0
    case PrimitiveType::TYPE_TIMESTAMPTZ:
289
0
        return create_timestamptz_wrapper(context, from_type);
290
7
    case PrimitiveType::TYPE_IPV4:
291
17
    case PrimitiveType::TYPE_IPV6:
292
17
        return create_ip_wrapper(context, from_type, to_type->get_primitive_type());
293
4
    case PrimitiveType::TYPE_DECIMALV2:
294
3.23k
    case PrimitiveType::TYPE_DECIMAL32:
295
6.45k
    case PrimitiveType::TYPE_DECIMAL64:
296
9.46k
    case PrimitiveType::TYPE_DECIMAL128I:
297
12.3k
    case PrimitiveType::TYPE_DECIMAL256:
298
12.3k
        return create_decimal_wrapper(context, from_type, to_type->get_primitive_type());
299
0
    case PrimitiveType::TYPE_CHAR:
300
0
    case PrimitiveType::TYPE_VARCHAR:
301
20
    case PrimitiveType::TYPE_STRING:
302
20
        return create_string_wrapper(from_type);
303
1.47k
    case PrimitiveType::TYPE_ARRAY:
304
1.47k
        return create_array_wrapper(context, from_type,
305
1.47k
                                    static_cast<const DataTypeArray&>(*to_type));
306
2
    case PrimitiveType::TYPE_STRUCT:
307
2
        return create_struct_wrapper(context, from_type,
308
2
                                     static_cast<const DataTypeStruct&>(*to_type));
309
3
    case PrimitiveType::TYPE_MAP:
310
3
        return create_map_wrapper(context, from_type, static_cast<const DataTypeMap&>(*to_type));
311
0
    case PrimitiveType::TYPE_HLL:
312
0
        return create_hll_wrapper(context, from_type, static_cast<const DataTypeHLL&>(*to_type));
313
0
    case PrimitiveType::TYPE_BITMAP:
314
0
        return create_bitmap_wrapper(context, from_type,
315
0
                                     static_cast<const DataTypeBitMap&>(*to_type));
316
0
    case PrimitiveType::TYPE_QUANTILE_STATE:
317
0
        return create_quantile_state_wrapper(context, from_type,
318
0
                                             static_cast<const DataTypeQuantileState&>(*to_type));
319
48.5k
    case PrimitiveType::TYPE_JSONB:
320
48.5k
        return create_cast_to_jsonb_wrapper(from_type, static_cast<const DataTypeJsonb&>(*to_type),
321
48.5k
                                            context ? context->string_as_jsonb_string() : false);
322
0
    case PrimitiveType::TYPE_VARBINARY:
323
0
        return create_varbinary_wrapper(from_type);
324
0
    default:
325
0
        break;
326
85.2k
    }
327
328
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
329
85.2k
}
330
331
} // namespace CastWrapper
332
333
class PreparedFunctionCast : public PreparedFunctionImpl {
334
public:
335
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
336
83.9k
            : wrapper_function(std::move(wrapper_function_)), name(name_) {}
337
338
0
    String get_name() const override { return name; }
339
340
protected:
341
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
342
83.9k
                        uint32_t result, size_t input_rows_count) const override {
343
83.9k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
344
83.9k
    }
345
346
83.9k
    bool use_default_implementation_for_nulls() const override { return false; }
347
83.9k
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {1}; }
348
349
private:
350
    CastWrapper::WrapperType wrapper_function;
351
    const char* name;
352
};
353
354
class FunctionCast final : public IFunctionBase {
355
public:
356
    FunctionCast(const char* name_, DataTypes argument_types_, DataTypePtr return_type_)
357
84.7k
            : name(name_),
358
84.7k
              argument_types(std::move(argument_types_)),
359
84.7k
              return_type(std::move(return_type_)) {}
360
361
83.9k
    const DataTypes& get_argument_types() const override { return argument_types; }
362
83.9k
    const DataTypePtr& get_return_type() const override { return return_type; }
363
364
    PreparedFunctionPtr prepare(FunctionContext* context, const Block& /*sample_block*/,
365
                                const ColumnNumbers& /*arguments*/,
366
83.9k
                                uint32_t /*result*/) const override {
367
83.9k
        return std::make_shared<PreparedFunctionCast>(
368
83.9k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
369
83.9k
                                                         get_return_type()),
370
83.9k
                name);
371
83.9k
    }
372
373
0
    String get_name() const override { return name; }
374
375
0
    bool is_use_default_implementation_for_constants() const override { return true; }
376
377
private:
378
    const char* name = nullptr;
379
380
    DataTypes argument_types;
381
    DataTypePtr return_type;
382
};
383
384
class FunctionBuilderCast : public FunctionBuilderImpl {
385
public:
386
    static constexpr auto name = "CAST";
387
84.7k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
388
389
84.7k
    FunctionBuilderCast() = default;
390
391
1
    String get_name() const override { return name; }
392
393
0
    size_t get_number_of_arguments() const override { return 2; }
394
395
0
    ColumnNumbers get_arguments_that_are_always_constant() const override { return {1}; }
396
397
protected:
398
    FunctionBasePtr build_impl(const ColumnsWithTypeAndName& arguments,
399
84.7k
                               const DataTypePtr& return_type) const override {
400
84.7k
        DataTypes data_types(arguments.size());
401
402
254k
        for (size_t i = 0; i < arguments.size(); ++i) {
403
169k
            data_types[i] = arguments[i].type;
404
169k
        }
405
406
84.7k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
407
84.7k
    }
408
409
84.7k
    bool skip_return_type_check() const override { return true; }
410
0
    DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override {
411
0
        return nullptr;
412
0
    }
413
414
0
    bool use_default_implementation_for_nulls() const override { return false; }
415
};
416
417
1
void register_function_cast(SimpleFunctionFactory& factory) {
418
1
    factory.register_function<FunctionBuilderCast>();
419
1
}
420
} // namespace doris